deka-0.6.0.0: Decimal floating point arithmetic

Safe HaskellSafe-Inferred
LanguageHaskell2010

Deka.Native.Abstract

Synopsis

Documentation

data Novem Source

A digit from one to nine. Useful to represent a most significant digit, or MSD, as an MSD cannot be the digit zero.

Constructors

D1 
D2 
D3 
D4 
D5 
D6 
D7 
D8 
D9 

data Decem Source

A digit from zero to nine.

Constructors

D0 
Nonem Novem 

Instances

data Decuple Source

A non-empty set of digits. The MSD must be from 1 to 9.

Constructors

Decuple Novem [Decem] 

uncons :: [a] -> Maybe (a, [a]) Source

data Aut Source

Either a set of digits, or zero. Unsigned.

Constructors

Nil

Zero

Plenus Decuple

Non-zero

Instances

intToAut :: Integral a => a -> Maybe Aut Source

Fails if the argument is less than zero.

data Firmado Source

Either a set of digits, or zero. Signed.

Constructors

Cero

Zero

Completo PosNeg Decuple

Non-zero

newtype Coefficient Source

The coefficient in a number; not used in infinities or NaNs.

Constructors

Coefficient 

Fields

unCoefficient :: Aut
 

newtype Exponent Source

The exponent in a number.

Constructors

Exponent 

Fields

unExponent :: Firmado
 

newtype Diagnostic Source

The diagnostic information in an NaN.

Constructors

Diagnostic 

data Noisy Source

Whether an NaN is quiet or signaling.

Constructors

Quiet 
Signaling 

Instances

data NonNum Source

Not a Number.

Constructors

NonNum 

Instances

data Value Source

All data in an abstract number except for the sign.

Instances

data Abstract Source

Abstract representation of all numbers covered by the General Decimal Arithmetic Specification.

Constructors

Abstract 

Fields

sign :: Sign
 
value :: Value
 

newtype AdjustedExp Source

Adjusted exponent. Roughly speaking this represents the coefficient and exponent of an abstract decimal, adjusted so there is a decimal point between the most significant digit of the coefficient and the remaning digits.

Constructors

AdjustedExp 

adjustedExp :: Coefficient -> Exponent -> AdjustedExp Source

Computes an adjusted exponent. The length of a zero coefficient is one.

abstractToString :: Abstract -> String Source

Transform an Abstract to a String. This conforms to the to-scientific-string transformation given in the General Decimal Arithmetic Specification at

http://speleotrove.com/decimal/daconvs.html#reftostr

with one exception: the specification provides that some finite numbers are represented without exponential notation. abstractToString always uses exponential notation on finite numbers.

abstractToDec :: Abstract -> (Dec, Flags) Source

Transforms an Abstract to a Dec. Result is computed in a context using the Pedantic initializer. Result is returned along with any status flags arising from the computation.