Comment by zX41ZdbW

3 years ago

I also did this when searching for a fast string-to-float conversion function for ClickHouse:

https://github.com/ClickHouse/ClickHouse/blob/master/src/IO/...

- we create a table, insert all four billion floats there, and check our functions with SQL queries.

Currently, the state-of-the-art library is https://github.com/lemire/fast_double_parser, but we use a slightly worse (but more performant) routine.

It is also interesting how to format floats in string in an efficient and user-friendly way.

For this problem, we switched iteratively: strtod -> Google's Double Conversion -> Ryu (patched) -> Dragonbox. Currently, we use Dragonbox.

> ...but we use a slightly worse (but more performant) routine.

If it (dragonbox?) is more performant, why is it also worse?

  • The fast algorithm is less accurate in the least significant bits. In zX41ZdbW's first link above, there's a code comment that includes the exact count of numbers grouped by how inaccurate the results were.