Skip to content

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

match *const_val {
Float(_f) => unimplemented!(),
Float(ConstFloat::F32(f)) => {
let i = unsafe { transmute::<_, u32>(f) };
Copy link
Contributor

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.
github-actions bot pushed a commit that referenced this pull request Aug 9, 2025
…n, r=petrochenkov

Prevent name collisions with internal implementation details

The implementation of the linkage attribute inside extern blocks defines symbols starting with _rust_extern_with_linkage_. If someone tries to also define this symbol you will get a symbol conflict or even an ICE. By adding an unpredictable component to the symbol name, this becomes less of an issue.

Spawned from the discussion at [#t-compiler > About static variables &#96;_rust_extern_with_linkage_&#42;&#96;](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/About.20static.20variables.20.60_rust_extern_with_linkage_*.60) cc `@ywxt`

Fixes rust-lang/rust#144940
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