Function core::num::dec2flt::algorithm::fast_path [] [src]

pub fn fast_path<T: RawFloat>(integral: &[u8], fractional: &[u8], e: i64) -> Option<T>
Unstable (dec2flt)

: internal routines only exposed for testing

The fast path of Bellerophon using machine-sized integers and floats.

This is extracted into a separate function so that it can be attempted before constructing a bignum.

The fast path crucially depends on arithmetic being correctly rounded, so on x86 without SSE or SSE2 it will be wrong (as in, off by one ULP occasionally), because the x87 FPU stack will round to 80 bit first before rounding to 64/32 bit. However, as such hardware is extremely rare nowadays and in fact all in-tree target triples assume an SSE2-capable microarchitecture, there is little incentive to deal with that. There's a test that will fail when SSE or SSE2 is disabled, so people building their own non-SSE copy will get a heads up.

FIXME: It would nevertheless be nice if we had a good way to detect and deal with x87.