HERA-0.2

Data.Number.MPFR

Contents

Synopsis

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.

type Dyadic = MPFR_TSource

data RoundMode Source

Constructors

Near 
Zero 
Up 
Down 

Instances

dyadicToStringSource

Arguments

:: RoundMode 
-> Word

number of significant digits

-> Word

base

-> Dyadic 
-> (String, Int) 

getMantissa :: Dyadic -> IntegerSource

getMantissa and getExp return values such that

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