pub fn compute_float<F: RawFloat>(q: i64, w: u64) -> BiasedFp
dec2flt
)Expand description
Compute w * 10^q using an extended-precision float representation.
Fast conversion of a the significant digits and decimal exponent a float to an extended representation with a binary float. This algorithm will accurately parse the vast majority of cases, and uses a 128-bit representation (with a fallback 192-bit representation).
This algorithm scales the exponent by the decimal exponent using pre-computed powers-of-5, and calculates if the representation can be unambiguously rounded to the nearest machine float. Near-halfway cases are not handled here, and are represented by a negative, biased binary exponent.
The algorithm is described in detail in “Daniel Lemire, Number Parsing at a Gigabyte per Second” in section 5, “Fast Algorithm”, and section 6, “Exact Numbers And Ties”, available online: https://arxiv.org/abs/2101.11408.pdf.