- type Dyadic = MPFR_T
- type Precision = Word
- data RoundMode
- add :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- sub :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- mul :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- div :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- inverse :: Dyadic -> Dyadic
- add_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- sub_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- mul_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- div_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- addw :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- addi :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- mulw :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- muli :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- divw :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- divi :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- wdiv :: RoundMode -> Precision -> Word -> Dyadic -> Dyadic
- idiv :: RoundMode -> Precision -> Int -> Dyadic -> Dyadic
- subw :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- subi :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- wsub :: RoundMode -> Precision -> Word -> Dyadic -> Dyadic
- isub :: RoundMode -> Precision -> Int -> Dyadic -> Dyadic
- addw_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- addi_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- mulw_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- muli_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- divw_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- divi_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- wdiv_ :: RoundMode -> Precision -> Word -> Dyadic -> (Dyadic, Int)
- idiv_ :: RoundMode -> Precision -> Int -> Dyadic -> (Dyadic, Int)
- subw_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- subi_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- wsub_ :: RoundMode -> Precision -> Word -> Dyadic -> (Dyadic, Int)
- isub_ :: RoundMode -> Precision -> Int -> Dyadic -> (Dyadic, Int)
- mul2w :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- mul2i :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- div2w :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- div2i :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- mul2w_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- mul2i_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- div2w_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- div2i_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- int2i :: RoundMode -> Precision -> Int -> Int -> Dyadic
- int2w :: RoundMode -> Precision -> Word -> Int -> Dyadic
- int2i_ :: RoundMode -> Precision -> Int -> Int -> (Dyadic, Int)
- int2w_ :: RoundMode -> Precision -> Word -> Int -> (Dyadic, Int)
- fma :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic -> Dyadic
- fms :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic -> Dyadic
- fma_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic -> (Dyadic, Int)
- fms_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic -> (Dyadic, Int)
- nextBelow :: Dyadic -> Dyadic
- sqr :: RoundMode -> Precision -> Dyadic -> Dyadic
- sqrt :: RoundMode -> Precision -> Dyadic -> Dyadic
- root :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- pow :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- poww :: RoundMode -> Precision -> Dyadic -> Word -> Dyadic
- powi :: RoundMode -> Precision -> Dyadic -> Int -> Dyadic
- wpoww :: RoundMode -> Precision -> Word -> Word -> Dyadic
- wpow :: RoundMode -> Precision -> Word -> Dyadic -> Dyadic
- sqr_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- sqrt_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- root_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- pow_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- poww_ :: RoundMode -> Precision -> Dyadic -> Word -> (Dyadic, Int)
- powi_ :: RoundMode -> Precision -> Dyadic -> Int -> (Dyadic, Int)
- wpoww_ :: RoundMode -> Precision -> Word -> Word -> (Dyadic, Int)
- wpow_ :: RoundMode -> Precision -> Word -> Dyadic -> (Dyadic, Int)
- exp :: RoundMode -> Precision -> Dyadic -> Dyadic
- exp2 :: RoundMode -> Precision -> Dyadic -> Dyadic
- exp10 :: RoundMode -> Precision -> Dyadic -> Dyadic
- log :: RoundMode -> Precision -> Dyadic -> Dyadic
- log2 :: RoundMode -> Precision -> Dyadic -> Dyadic
- log10 :: RoundMode -> Precision -> Dyadic -> Dyadic
- sinh :: RoundMode -> Precision -> Dyadic -> Dyadic
- cosh :: RoundMode -> Precision -> Dyadic -> Dyadic
- tanh :: RoundMode -> Precision -> Dyadic -> Dyadic
- exp_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- exp2_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- exp10_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- log_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- log2_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- log10_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- sinh_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- cosh_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- tanh_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- neg :: RoundMode -> Precision -> Dyadic -> Dyadic
- absD :: RoundMode -> Precision -> Dyadic -> Dyadic
- dim :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- neg_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- absD_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- dim_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- isNaN :: Dyadic -> Bool
- isInfinite :: Dyadic -> Bool
- isNumber :: Dyadic -> Bool
- isZero :: Dyadic -> Bool
- greater :: Dyadic -> Dyadic -> Bool
- greatereq :: Dyadic -> Dyadic -> Bool
- less :: Dyadic -> Dyadic -> Bool
- lesseq :: Dyadic -> Dyadic -> Bool
- equal :: Dyadic -> Dyadic -> Bool
- maxD :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- minD :: RoundMode -> Precision -> Dyadic -> Dyadic -> Dyadic
- maxD_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- minD_ :: RoundMode -> Precision -> Dyadic -> Dyadic -> (Dyadic, Int)
- sgn :: Dyadic -> Int
- dyadicToDouble :: RoundMode -> Dyadic -> Double
- dyadicToWord :: RoundMode -> Dyadic -> Word
- dyadicToInt :: RoundMode -> Dyadic -> Int
- dyadicToString :: RoundMode -> Word -> Word -> Dyadic -> (String, Int)
- decompose :: Dyadic -> (Integer, Int)
- toStringExp :: Word -> Dyadic -> String
- toString :: Word -> Dyadic -> String
- pi :: RoundMode -> Precision -> Dyadic
- log2c :: RoundMode -> Precision -> Dyadic
- euler :: RoundMode -> Precision -> Dyadic
- catalan :: RoundMode -> Precision -> Dyadic
- pi_ :: RoundMode -> Precision -> (Dyadic, Int)
- log2c_ :: RoundMode -> Precision -> (Dyadic, Int)
- euler_ :: RoundMode -> Precision -> (Dyadic, Int)
- catalan_ :: RoundMode -> Precision -> (Dyadic, Int)
- set :: RoundMode -> Precision -> Dyadic -> Dyadic
- set_ :: RoundMode -> Precision -> Dyadic -> (Dyadic, Int)
- fromDouble :: RoundMode -> Precision -> Double -> Dyadic
- fromInt :: RoundMode -> Precision -> Int -> Dyadic
- fromWord :: RoundMode -> Precision -> Word -> Dyadic
- fromDouble_ :: RoundMode -> Precision -> Double -> (Dyadic, Int)
- fromInt_ :: RoundMode -> Precision -> Int -> (Dyadic, Int)
- fromWord_ :: RoundMode -> Precision -> Word -> (Dyadic, Int)
- fromIntegerA :: RoundMode -> Precision -> Integer -> Dyadic
- compose :: RoundMode -> Precision -> (Integer, Int) -> Dyadic
- fromString :: String -> Precision -> Word -> Dyadic
- getPrec :: Dyadic -> Precision
- getMantissa :: Dyadic -> Integer
- getExp :: Dyadic -> Int
- minPrec :: Precision
- one :: Dyadic
- zero :: Dyadic
- addPrec :: Dyadic -> Dyadic -> Precision

# Documentation

This module should always be imported qualified.

### Naming

- functions ending with _ return a pair (value, rounding indicator). Rounding indicator indicates whether the result is rounded and in which directon as described in the MPFR manual.
- the same functions without the _ return just the value.
- functions with added "w" correspond to MPFR _ui functions
- functions with added "i" correspond to MPFR _si functions

### Equality testing

Equality works as follows:

- NaN /= Nan,
- Infinity = Infinity,
- -Infinity = -Infinity
- otherwise normal comparison

### Ordering

Ordering works as follows:

- compare NaN _ = GT
- compare _ NaN = GT
- infinity < _ = False
- -infinity > _ = False
- NaN [<,>,>=,<=] _ = False

This mimics the behaviour of built in haskell Float and Double.

### Num instance

Operations defined in Num will be computed so that no precision is lost.

isInfinite :: Dyadic -> BoolSource

dyadicToDouble :: RoundMode -> Dyadic -> DoubleSource

dyadicToWord :: RoundMode -> Dyadic -> WordSource

dyadicToInt :: RoundMode -> Dyadic -> IntSource

toStringExp :: Word -> Dyadic -> StringSource

getMantissa :: Dyadic -> IntegerSource

getMantissa and getExp return values such that

d = getMantissa d * 2^(getExp d - ceiling ((getPrec d) / bitsPerMPLimb)* bitsPerMPLimb )