That seems super dumb indeed. I really wish JSON had an actual decimal type, we already have valid "e" notation (like 10e2), why not have a "d" notation, like 5d3 (meaning 5.3) or 5.3d.
It would be if it did any arithmetic. But maybe it works without any computation. Then the fp arithmetic is not a problem. Or could you provide an example?
Neither 0.1 nor 0.01 are representable exactly in binary (much like 1/3 is not representable exactly in decimal). Thus means that your cents, if any, are never precise. Not a big deal for Swift transfers where you can safely round to cents. But various commissions, taxes, and fees are often very small fractions, and rounding errors become noticeable with large quantities of small amounts added / subtracted. They may be too small to matter financially, but they are bothersome because your sums do not match exactly where they should, and this affects trust to the system.
IDK about banks; in one billing system where I was involved we used decimals (and clear rules of assignment of the rounding errors), in another, all amounts were in picodollars.
Should be fine up to about 9 quadrillion[1]. Though with arithmetic it can get messy. The example doesn't show, but I hope dollar amounts are in cents and don't use decimals.
Maybe when sending money to Zimbabwe it could be an issue.
Thanks for bringing this up chuzz - we're actually only using base amounts for the money representation for amounts here. (no $2.3232321), only (amount: 232)
See the https://dinerojs.com/ package to see how money is handled (tldr it's a combination of currency and amount which helps us get to the root #)
RedShift1|1 year ago
wiktor-k|1 year ago
svapnil|1 year ago
For financial calculations I recommend using Dinero.js
krystofee|1 year ago
nine_k|1 year ago
IDK about banks; in one billing system where I was involved we used decimals (and clear rules of assignment of the rounding errors), in another, all amounts were in picodollars.
morepork|1 year ago
Maybe when sending money to Zimbabwe it could be an issue.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
svapnil|1 year ago
See the https://dinerojs.com/ package to see how money is handled (tldr it's a combination of currency and amount which helps us get to the root #)