2 ms·
Yes, if you want to work with an existing system, you want to follow the conventions of that system. Fixed point (ie calculate everything in cents) is a good c
by eru 4y ago
Yes, if you want to work with an existing system, you want to follow the conventions of that system.
Fixed point (ie calculate everything in cents) is a good convention for lots of things to do with money. But it's not a good convention to have as the default in a language like Python.
> Within a calculation, it may be fine to use float, but the number going into ledgers or transactions need to have the predefined precision.
I was not suggesting the use of float. I was suggesting using rational numbers by default. See eg https://docs.python.org/3/library/fractions.html https://docs.python.org/3/library/fractions.html