Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement floats by running the ops on the host architecture #42

Merged
merged 3 commits into from
Jul 7, 2016
Merged

implement floats by running the ops on the host architecture #42

merged 3 commits into from
Jul 7, 2016

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 5, 2016

We can't possibly hope to emulate all target architectures' float quirks. Let's just assert that anyone depending on the minuscule differences between architectures deserves their code to be broken when run through miri.

Instead of running on the host architecture, we can also use one of the following crates for deterministic behaviour not depending on the host architecture

Only accurate will emulate the computation closely. The other two are much more precise and will thus differ from running the code on the target.

fixes #35

@@ -178,7 +179,15 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}}
}
match *const_val {
Float(_f) => unimplemented!(),
Float(ConstFloat::F32(f)) => {
let i = unsafe { transmute::<_, u32>(f) };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the spirit of paranoia, I'd rather avoid adding transmutes and instead use the byteorder crate's {read,write}_f{32,64} methods (with matching methods on Memory, I suppose).

@solson solson merged commit f4afb59 into rust-lang:master Jul 7, 2016
@oli-obk oli-obk deleted the floating_in_space branch July 7, 2016 10:36
erickt pushed a commit to erickt/miri that referenced this pull request Feb 4, 2022
Fix serde deserialization for custom hashers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support floating point types f32 and f64
2 participants