diff options
| author | Alexis Beingessner <a.beingessner@gmail.com> | 2017-11-15 15:05:47 -0500 |
|---|---|---|
| committer | Alexis Beingessner <a.beingessner@gmail.com> | 2017-11-23 16:55:52 -0500 |
| commit | 439576fd7bedf741db5fb6a21c902e858d51f2a0 (patch) | |
| tree | 20e757796ce44c0ff3af226a2388e7f11e3123b6 /src/rustllvm/RustWrapper.cpp | |
| parent | 88a28ff6028cf197ed6b4185d8cd4887f05e3e07 (diff) | |
| download | rust-439576fd7bedf741db5fb6a21c902e858d51f2a0.tar.gz rust-439576fd7bedf741db5fb6a21c902e858d51f2a0.zip | |
Make float::from_bits transmute (and update the documentation to reflect this).
The current implementation/documentation was made to avoid sNaN because of potential safety issues implied by old/bad LLVM documentation. These issues aren't real, so we can just make the implementation transmute (as permitted by the existing documentation of this method). Also the documentation didn't actually match the behaviour: it said we may change sNaNs, but in fact we canonicalized *all* NaNs. Also an example in the documentation was wrong: it said we *always* change sNaNs, when the documentation was explicitly written to indicate it was implementation-defined. This makes to_bits and from_bits perfectly roundtrip cross-platform, except for one caveat: although the 2008 edition of IEEE-754 specifies how to interpet the signaling bit, earlier editions didn't. This lead to some platforms picking the opposite interpretation, so all signaling NaNs on x86/ARM are quiet on MIPS, and vice-versa. NaN-boxing is a fairly important optimization, while we don't even guarantee that float operations properly preserve signalingness. As such, this seems like the more natural strategy to take (as opposed to trying to mangle the signaling bit on a per-platform basis). This implementation is also, of course, faster.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
