decimal-arithmetic-0.1.0.1: An implementation of Mike Cowlishaw's General Decimal Arithmetic Specification

Safe HaskellTrustworthy
LanguageHaskell2010

Numeric.Decimal.Operation

Description

Eventually most or all of the arithmetic operations described in the General Decimal Arithmetic Specification will be provided here. For now, the operations are mostly limited to those exposed through various class methods.

It is not usually necessary to import this module.

Synopsis

Documentation

abs :: (Precision p, Rounding r) => Number p r -> Number p r Source

If the operand is negative, the result is the same as using the minus operation on the operand. Otherwise, the result is the same as using the plus operation on the operand.

add :: (Precision p, Rounding r) => Number p r -> Number p r -> Number p r Source

Add two operands.

subtract :: (Precision p, Rounding r) => Number p r -> Number p r -> Number p r Source

Subtract the second operand from the first.

multiply :: (Precision p, Rounding r) => Number p r -> Number p r -> Number p r Source

Multiply two operands.

divide :: (FinitePrecision p, Rounding r) => Number p r -> Number p r -> Number p r Source

Divide the first dividend operand by the second divisor using long division.

plus :: (Precision p, Rounding r) => Number p r -> Number p r Source

Unary plus

minus :: (Precision p, Rounding r) => Number p r -> Number p r Source

Unary minus (negation)

compare :: (Precision p, Rounding r) => Number p r -> Number p r -> Number p r Source

Compare the values of two operands numerically, returning -1 if the first is less than the second, 0 if they are equal, or 1 if the first is greater than the second.