4 ms·
There are multiple factors: Doubles can exactly represent all 16 digit ints (IIRC) which is good enough for most use cases, you can catch the out of range case
by fvdessen 3y ago
There are multiple factors:
Doubles can exactly represent all 16 digit ints (IIRC) which is good enough for most use cases, you can catch the out of range cases (as you should do with ints as well)
If you use long ints you must track the decimal precision along the value which is not always trivial if you use mixed currencies.
Long ints are not guaranteed to correctly roundtrip through json serialisation / deserialisation
Doubles are easier to handle in the frontend
Currency math is different enough from regular math that you need special operator functions anyway so it’s not like ints are easier to handle either