4 ms·
> The second one is a number You mean a float, right?
by peoplefromibiza 3y ago
> The second one is a number
You mean a float, right?
- k__ 3y agoA double-precision 64-bit binary format IEEE 754, if you will!
- peoplefromibiza 3y agofun fact: that's JavaScript. JavaScript only supports double-precision 64-bit binary format IEEE 754. But JSON doesn't disallow arbitrary precision numbers, that's up to the parser implementation. number integer fraction exponent In fact not all implementations support IEEE 754 doubles, and, from my experience, when dealing with money and rounding errors, many decide to serialize numbers as exact strings and use custom code for deserialization.
- berkes 3y ago> when dealing with money and rounding errors, many decide to serialize numbers as exact strings and use custom code for deserialization That's exactly what I'm doing. And indeed another reason why I feel embarrassed by JSON. I mean, we -the industry- have been doing financial data transport over computer networks, for how long now? fifty years? And we keep "inventing" transport formats that unsolve issues that have long been solved and done. XML had this solved[1]. Hell, even the ancient MT940[2] had this solved. [1] https://web.archive.org/web/20200618100100/https://deutschebank.nl/nl/docs/MT94042_EN.pdf https://web.archive.org/web/20200618100100/https://deutscheb... (pdf warning) [2] e.g. https://financialdataexchange.org/FDX/About/OFX-Work-Group.aspx?WebsiteKey=deae9d6d-1a7a-457b-a678-8a5517f8a474&a315d1c24e44=3#a315d1c24e44 https://financialdataexchange.org/FDX/About/OFX-Work-Group.a...