Better HN
topnewbestaskshowjobs
Log inSign up

gnutaler

-6 karma · joined Oct 25, 2020 (6y ago) · 2 submissions

Submissions

comment 6y ago · link · parent

The specification is not sloppy, it specifies precisely the wire format, and does expressly cover this problem of how the values MUST be interpreted. The specification does not cover how the application should render the amount when showing it to the user, so when applications show the amount to the user they can of course still render it in a culturally appropriate way.

comment 6y ago · link · parent

If you deal with money, you do have to store the fraction separately anyway and clearly should not use floating point. But that's beyond the point. The upper bound is there to ensure that you do not have to use BigNum in languages like JavaScript, not to tempt you to simply represent the amount in a double.