fastfloat / fast_float

Fast and exact implementation of the C++ from_chars functions for number types: 4x to 10x faster than strtod, part of GCC 12, Chromium, Redis and WebKit/Safari
Apache License 2.0
1.56k stars 135 forks source link

Feature request: fast_fixed_point #134

Open spannella opened 2 years ago

spannella commented 2 years ago

Hi in many applications I have I cannot use double / float but use a fixed-point integer representation, for instance storing the number in a int64_t with the stored value is 1 billion times the original value allowing for 9 digits of decimal. Example: int64_t val; fast_fixed_point("42.123456789", val, 9) then val would be set to 42123456789

I think it should be pretty easy to adapt the current code to support this use case.

lemire commented 2 years ago

Pull request invited!