Remix.run Logo
foresterre 4 hours ago

As a general rule, you always include the currency code (EUR, SEK, USD etc.) and if possible also the amount of decimals, when using minor units.

Currency codes can be found in ISO 4217.

0xffff2 an hour ago | parent | next [-]

ISO 4217 also defines the number of significant digits after the decimal separator if Wikipedia is to be believed.

lxgr 4 hours ago | parent | prev [-]

Yes, definitely always include the number of digits, but at your system boundary you still have to pray that whoever you're working with isn't silently dropping that number and re-deriving it from their own, almost-4217-compliant currency database.

Redundancy can be great, but it's not a panacea, since it's not guaranteed to be used in an optimal way.