|
|
|
|
|
by berkes
815 days ago
|
|
When I say dangerously naive, I mean in a way that people can go to jail¹ for "loosing" or "inventing" cents. Which your software will do if you use floats. ¹IANAL. But this was told when legal people looked at our architecture. |
|
The goal is not to avoid rounding errors (which would be quite difficult when the true account value can be an irrational number, as with 3% APR compounding monthly), but to have the exact same rounding errors that are prescribed by the accounting practices. Which may vary depending on legislation.
A decimal floating point is usually a better starting point than integers are.