rust/src/libstd
Alexis Beingessner 439576fd7b 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.
2017-11-23 16:55:52 -05:00
..
collections Improvided map_entry_replace examples 2017-11-11 19:45:32 +01:00
ffi std: Avoid use of libc in portable modules 2017-11-09 07:56:44 -08:00
io Fixed several pulldown warnings when documenting libstd. 2017-11-14 17:22:57 +08:00
net Improve docs for UdpSocket::set_nonblocking. 2017-10-26 10:05:54 -04:00
os Fix doc build on other architectures than linux 2017-10-24 21:58:53 +02:00
prelude Move unused-extern-crate to late pass 2017-08-27 19:02:24 +09:00
rand std: Remove rand crate and module 2017-11-08 20:41:17 -08:00
sync std: Remove rand crate and module 2017-11-08 20:41:17 -08:00
sys Auto merge of #45896 - malbarbo:use-libc-const, r=alexcrichton 2017-11-14 13:46:19 +00:00
sys_common std: Avoid use of libc in portable modules 2017-11-09 07:56:44 -08:00
thread Make join a link to the function's documentation 2017-11-02 19:09:31 +02:00
time Auto merge of #44436 - MicroJoe:master, r=alexcrichton 2017-09-23 22:21:32 +00:00
ascii.rs Remove unused AsciiExt imports and fix tests related to ascii methods 2017-11-03 21:27:40 +01:00
build.rs rustbuild: Support specifying archiver and linker explicitly 2017-10-15 22:10:07 +03:00
Cargo.toml std: Remove rand crate and module 2017-11-08 20:41:17 -08:00
env.rs Warn about non-portability of glob patterns 2017-11-07 17:01:56 +00:00
error.rs Merge remote-tracking branch 'upstream/master' 2017-09-30 10:08:33 -04:00
f32.rs Make float::from_bits transmute (and update the documentation to reflect this). 2017-11-23 16:55:52 -05:00
f64.rs Make float::from_bits transmute (and update the documentation to reflect this). 2017-11-23 16:55:52 -05:00
fs.rs Made fs::copy return the length of the main stream 2017-09-27 19:43:05 -07:00
heap.rs rustc: Handle some libstd symbole exports better 2017-11-04 20:01:11 -07:00
lib.rs std: Remove rand crate and module 2017-11-08 20:41:17 -08:00
macros.rs fix stringify docs in std 2017-10-22 13:17:23 -04:00
memchr.rs Fix inconsistent doc headings 2017-08-24 18:42:53 +02:00
num.rs Auto merge of #40706 - irfanhudda:doc-next-power-of-two, r=alexcrichton 2017-06-08 01:07:08 +00:00
panic.rs auto trait future compatibility lint 2017-11-03 16:13:21 -02:00
panicking.rs Update bootstrap compiler 2017-08-31 06:58:58 -07:00
path.rs Rollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichton 2017-11-13 17:09:41 +08:00
primitive_docs.rs Update array documentation for Clone trait changes 2017-10-17 08:29:29 +02:00
process.rs Auto merge of #45295 - Technius:docs/process, r=steveklabnik 2017-10-29 06:24:20 +00:00
rt.rs std: Remove rand crate and module 2017-11-08 20:41:17 -08:00