12.5 (one two dot five) and return a 64-bit double-precision
floating point number like
12.5 (twelve point five). Some numbers (like
12.3) aren’t exactly representable as an
f64 but
ParseNumberF64 still has
to return the best approximation. In March 2020, Daniel Lemire
published
some source code for a new,
fast algorithm to do this, based on an original idea by Michael Eisel. Here’s
how it works.
Preliminaries
Fallback Implementation
First, a caveat. The Eisel-Lemire algorithm is very fast (Lemire’s blog
post
contains impressive benchmark numbers, e.g. 9 times faster than the C standard
library’s
strtod) but it isn’t comprehensive. There are a small proportion of