3 ms·
Unfortunately, JSON doesn't have a mechanism for 100% accuracy in transmitting binary floating point numbers. Everything gets marshaled to decimal float, and th
by kstenerud 6y ago
Unfortunately, JSON doesn't have a mechanism for 100% accuracy in transmitting binary floating point numbers. Everything gets marshaled to decimal float, and then unmarshaled to binary float - even in machine-to-machine communication. That's simply a limitation of the format.
It's part of the reason I developed Concise Encoding: https://github.com/kstenerud/concise-encoding/#example https://github.com/kstenerud/concise-encoding/#example which allows hex float notation when you need to be exact.
- enriquto 6y ago> Unfortunately, JSON doesn't have a mechanism for 100% accuracy in transmitting binary floating point numbers. If it was just inaccurate! It cannot even deal with straightforward floats like inf, nan, or minus zero!