[Haskell-cafe] What is a safe Haskell data type to store and manipulate Money values?
Joachim Durchholz
jo at durchholz.org
Thu Apr 6 09:35:34 UTC 2017
Am 06.04.2017 um 08:32 schrieb David Turner:
> They may not even mention the columns-of-numbers-must-add-up
> thing because that's so fundamental it almost goes without saying.
I have seen very different policies on that.
From "it must be exact" to "don't worry if the difference is less than
0.5*number-of-summands because then it could be a round-off error".
It all depends on whether there's somebody who wants to double-check.
For taxes calculations (any percentages actually), round-off errors are
unavoidable. People tend to shift them around to minimize that error -
that's why taxes are typically applied to sums, not to individual
summands; the per-summand tax breakdowns are then taken to be purely
informative and need not add up.
And then there's "creative accounting" where these differences are
larger than just a round-off error - that's what auditors are trying to
find, and they don't want your numbers to add up because that in itself
is relevant, they want your numbers to add up because it makes their
jobs easier.
More information about the Haskell-Cafe
mailing list