Hoogle Search
Within LTS Haskell 24.25 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
safe-decimal Numeric.Decimal Multiply all decimal numbers in the list while doing rounding.
>>> :set -XDataKinds >>> product [1.1, 20.02, 300.003] :: Double 6606.666066000001 >>> xs <- arithM (mapM fromRational [1.1, 20.02, 300.003] :: Arith [Decimal RoundHalfUp 4 Int]) >>> xs [1.1000,20.0200,300.0030] >>> productDecimalBoundedWithRounding xs 6606.6661
-
safe-decimal Numeric.Decimal No documentation available.
-
safe-decimal Numeric.Decimal Increase the precision of a Decimal backed by a bounded type, use roundDecimal if inverse is desired.
>>> import Numeric.Decimal >>> d2 <- arithM (1.65 :: Arith (Decimal RoundHalfUp 2 Int16)) >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 3 Int16) 1.650 >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 4 Int16) 1.6500 >>> scaleUpBounded d2 :: IO (Decimal RoundHalfUp 5 Int16) *** Exception: arithmetic overflow
-
safe-decimal Numeric.Decimal Compute signum of a decimal, always one of 1, 0 or -1
-
safe-decimal Numeric.Decimal Sum a list of decimal numbers
>>> :set -XDataKinds >>> sequenceA [1.1, 20.02, 300.003] >>= sumDecimalBounded :: Arith (Decimal RoundHalfUp 3 Int) Arith 321.123
-
safe-decimal Numeric.Decimal Multiply two bounded decimal numbers, adjusting their scale at the type level as well.
-
safe-decimal Numeric.Decimal Multiply two decimal numbers, while rounding the result according to the rounding strategy.
-
safe-decimal Numeric.Decimal Multiply two decimal numbers that have the same scale, while throwing PrecisionLoss whenever multiplication cannot be done without rounding. Also checks for bounds and can throw Overflow/Underflow.
absBounded :: (MonadThrow m, Num p, Ord p) => p -> m psafe-decimal Numeric.Decimal.BoundedArithmetic Compute absolute value, while checking for Overflow
divBounded :: (MonadThrow m, Integral a, Bounded a) => a -> a -> m asafe-decimal Numeric.Decimal.BoundedArithmetic Divide two numbers while checking for Overflow and DivideByZero