diff --git a/src/Currency.fs b/src/Currency.fs index f511ead..aff5ebc 100644 --- a/src/Currency.fs +++ b/src/Currency.fs @@ -15,8 +15,10 @@ module Currency = module Cent = /// max of two cent values let max (c1: int64) (c2: int64) = max (int64 c1) (int64 c2) * 1L + /// min of two cent values let min (c1: int64) (c2: int64) = min (int64 c1) (int64 c2) * 1L + /// derive a rounded cent value from a decimal according to the specified rounding method let round rounding (m: decimal) = match rounding with @@ -25,7 +27,9 @@ module Currency = | Round mpr -> Math.Round(m, 0, mpr) |> int64 |> (( * ) 1L) + /// lower to the base currency unit let fromDecimal (m: decimal) = round (Round MidpointRounding.AwayFromZero) (m * 100m) + /// raise to the standard currency unit let toDecimal (c: int64) = decimal c / 100m