submited by

Style Pass

The implemenation also contains a (fast!) strtod implementation, which can be used to convert decimal numbers with at most 17 significant decimal digits back into binary floating-point numbers. (Note that none of the algorithms here will ever produce more than 17 significant digits.)

These algorithms (currently) assume that the input rounding algorithm uses round-to-nearest-even to break ties. Grisu2 only is optimal for ~99% of all floating point numbers, though it guarantees the first property for all of its inputs, regardless of how the input rounding mode breaks ties.

For this benchmark uniformly distributed random doubles in the range [1,2] have been generated. These numbers were then rounded to N significant digits and converted to decimal using the given algorithm.

Uniformly distributed random numbers in the range [0, 10^10]. Each benchmark is run 10 times (using different numbers each run).

Read more github.com/a...