https://github.com/abseil/abseil-cpp/blob/master/absl/string...
ETA: I adapted the benchmark in the blog to use absl::from_chars and it's more than twice as fast as strtod.
But to be fair, the C++17 example doesn't check for underflow or overflow either.
[0]: https://github.com/ulfjack/ryu/blob/master/README.md
[1]: https://news.ycombinator.com/item?id=17633182
[2]: https://github.com/DaveJarvis/JMathTeX/blob/master/README.md
Parsing floating point strings, always producing the IEEE float or double closest to the number given, is surprisingly hard.
The hard cases are big exponents and large numbers of decimal digits. In general, it requires arbitrarily large integers (OK, OK, up to the maximum size of a double ~2^1023) and long division on said large integers. Denormalized is a pain for sure.
Did this recently. https://github.com/titzer/virgil/blob/master/aeneas/src/vst/...
1) You're writing a JSON/some other human-readable serialization library 2) You need to interact with some API that you can't change that sends floats over the wire as strings (a subset of which will fall into the case of (1)).
For something like currencies you'd need a custom parsing engine anyways since you'll typically represent monetary values as fixed-width integer multiples of the smallest unit (eg; cents or basis points) except for trading engines where proper accounting isn't required. In fact, a lookup table may even be faster if the valid values are bounded.
My guess is most of the things in (2) are going to be reading telemetry from embedded devices with firmware that simply won't be changed anymore and values are sent as text.
That means that not all JSON values can be represented as IEEE754 doubles (Javascript Numbers) and not all IEEE754 doubles can be represented as JSON values. It's a lossy conversion.
[1] https://www.ecma-international.org/publications/files/ECMA-S...
As for exchanges, CME _only_ had FIX for latency-sensitive order entry until the iLink 3 migration began last year. CME is huge and there are others like it, even further behind. There is plenty of liquidity you're missing if you ignore non-binary protocols.