@@ -83,9 +83,9 @@ module Hledger.Data.Amount (
8383 showAmountWithZeroCommodity ,
8484 showAmountDebug ,
8585 showAmountWithoutPrice ,
86- setAmountPrecision ,
86+ amountSetPrecision ,
8787 withPrecision ,
88- setFullPrecision ,
88+ amountSetFullPrecision ,
8989 setAmountInternalPrecision ,
9090 withInternalPrecision ,
9191 setAmountDecimalPoint ,
@@ -129,7 +129,8 @@ module Hledger.Data.Amount (
129129 showMixedAmountLinesB ,
130130 wbToText ,
131131 wbUnpack ,
132- setMixedAmountPrecision ,
132+ mixedAmountSetPrecision ,
133+ mixedAmountSetFullPrecision ,
133134 canonicaliseMixedAmount ,
134135 -- * misc.
135136 ltraceamount ,
@@ -330,17 +331,17 @@ amountIsZero Amount{aquantity=q} = q == 0
330331
331332-- | Set an amount's display precision, flipped.
332333withPrecision :: Amount -> AmountPrecision -> Amount
333- withPrecision = flip setAmountPrecision
334+ withPrecision = flip amountSetPrecision
334335
335336-- | Set an amount's display precision.
336- setAmountPrecision :: AmountPrecision -> Amount -> Amount
337- setAmountPrecision p a@ Amount {astyle= s} = a{astyle= s{asprecision= p}}
337+ amountSetPrecision :: AmountPrecision -> Amount -> Amount
338+ amountSetPrecision p a@ Amount {astyle= s} = a{astyle= s{asprecision= p}}
338339
339340-- | Increase an amount's display precision, if needed, to enough decimal places
340341-- to show it exactly (showing all significant decimal digits, excluding trailing
341342-- zeros).
342- setFullPrecision :: Amount -> Amount
343- setFullPrecision a = setAmountPrecision p a
343+ amountSetFullPrecision :: Amount -> Amount
344+ amountSetFullPrecision a = amountSetPrecision p a
344345 where
345346 p = max displayprecision naturalprecision
346347 displayprecision = asprecision $ astyle a
@@ -841,8 +842,13 @@ ltraceamount :: String -> MixedAmount -> MixedAmount
841842ltraceamount s = traceWith (((s ++ " : " ) ++ ). showMixedAmount)
842843
843844-- | Set the display precision in the amount's commodities.
844- setMixedAmountPrecision :: AmountPrecision -> MixedAmount -> MixedAmount
845- setMixedAmountPrecision p = mapMixedAmount (setAmountPrecision p)
845+ mixedAmountSetPrecision :: AmountPrecision -> MixedAmount -> MixedAmount
846+ mixedAmountSetPrecision p = mapMixedAmount (amountSetPrecision p)
847+
848+ -- | In each component amount, increase the display precision sufficiently
849+ -- to render it exactly (showing all significant decimal digits).
850+ mixedAmountSetFullPrecision :: MixedAmount -> MixedAmount
851+ mixedAmountSetFullPrecision = mapMixedAmount amountSetFullPrecision
846852
847853mixedAmountStripPrices :: MixedAmount -> MixedAmount
848854mixedAmountStripPrices = mapMixedAmount (\ a -> a{aprice= Nothing })
0 commit comments