Correction : Calc.Balance : union => unionWith : évite une éventuelle surprise.
[comptalang.git] / lib / Hcompta / Model / Amount / Quantity.hs
index 3fabd96620ffa1215160fa283f353e68f4acec3d..1ce1f385c46251bdc753357663859cf48e8068fd 100644 (file)
@@ -25,19 +25,20 @@ deriving instance Data Quantity
 
 representation :: String
 nil :: Quantity
-is_zero :: Word8 -> Quantity -> Bool
+is_zero :: Quantity -> Bool
 round :: Word8 -> Quantity -> Quantity
 #ifdef DOUBLE
 representation = "Double"
 nil = 0.0
 
-round :: fromInteger $ round $ (f * (10^n)) / (10.0^^n)
+round n f = fromInteger $ round $ (f * (10^n)) / (10.0^^n)
 
-is_zero decimal_places quantity =
-       floor quantity == 0 && -- NOTE: check integral part, in case of an overflow in roundTo'
-       0 == roundTo' decimal_places quantity
-       where
-               roundTo' n f = fromInteger $ round $ f * (10 ^ n)
+is_zero = (== 0) . decimalMantissa
+--is_zero decimal_places quantity =
+--     floor quantity == 0 && -- NOTE: check integral part, in case of an overflow in roundTo'
+--     0 == roundTo' decimal_places quantity
+--     where
+--             roundTo' n f = fromInteger $ round $ f * (10 ^ n)
 
 #else
 representation = "Decimal"
@@ -45,8 +46,9 @@ nil = fromInteger 0
 
 round = Data.Decimal.roundTo
 
-is_zero decimal_places quantity =
-       (== 0) $ decimalMantissa $
-       Hcompta.Model.Amount.Quantity.round decimal_places quantity
+is_zero = (== 0) . decimalMantissa
+--is_zero decimal_places quantity =
+--     (== 0) $ decimalMantissa $
+--     Hcompta.Model.Amount.Quantity.round decimal_places quantity
 #endif