test zero to 8 instead of 10 places, workaround for rounding error affecting a real-world transaction

This commit is contained in:
Simon Michael 2010-05-25 22:17:54 +00:00
parent d52283f314
commit 4120a874d8

View File

@ -150,7 +150,8 @@ isZeroAmount = null . filter (`elem` "123456789") . showAmountWithoutPrice
-- | Is this amount "really" zero, regardless of the display precision ?
-- Since we are using floating point, for now just test to some high precision.
isReallyZeroAmount :: Amount -> Bool
isReallyZeroAmount = null . filter (`elem` "123456789") . printf "%.10f" . quantity
isReallyZeroAmount = null . filter (`elem` "123456789") . printf ("%."++show zeroprecision++"f") . quantity
where zeroprecision = 8
-- | Access a mixed amount's components.
amounts :: MixedAmount -> [Amount]