HERA-0.2ContentsIndex
Data.Number.Real
Synopsis
data CReal
type Nat = Word
type Chain = Nat -> Interval
data PBool
= PTrue
| PFalse
| Indeterminate
min :: CReal -> CReal -> CReal
max :: CReal -> CReal -> CReal
lim :: (Nat -> CReal) -> (Nat -> CReal) -> CReal
limRec :: CReal -> (CReal -> Nat -> (CReal, CReal)) -> CReal
limRat :: (Nat -> Dyadic) -> (Nat -> Dyadic) -> CReal
infSum :: (Nat -> CReal) -> (Nat -> CReal) -> CReal
infSumRec :: CReal -> (CReal -> Nat -> (CReal, CReal)) -> CReal
approx :: CReal -> Nat -> Either (Dyadic, Word) Dyadic
pCompare :: CReal -> CReal -> Nat -> POrdering
(<.) :: CReal -> CReal -> Nat -> PBool
(>.) :: CReal -> CReal -> Nat -> PBool
sqrt :: CReal -> CReal
exp :: CReal -> CReal
log :: CReal -> CReal
fromDyadic :: Dyadic -> CReal
fromInt :: Int -> CReal
fromWord :: Word -> CReal
fromString :: String -> CReal
toString :: Nat -> CReal -> String
toStringDec :: Nat -> CReal -> String
Documentation
show x will output as much decimalas as a standard IEEE 754 double if possible.
(==) and (/=) should not be used as x == y will diverge if two reals should be equal.
data CReal

Real number is represented as a chain of dyadic intervals which are neither necessarily nested nor bounded away from 0.

On n-th stage computations are performed with precision of n bits.

show/hide Instances
Eq CReal
Fractional CReal
Num CReal
Read CReal
Show CReal
type Nat = Word
type Chain = Nat -> Interval
data PBool
Partial booleans
Constructors
PTrueequivalent to True
PFalseequivalent to False
Indeterminateneither True nor False.
show/hide Instances
Eq PBool
Ord PBool
Show PBool
min :: CReal -> CReal -> CReal
max :: CReal -> CReal -> CReal
lim
:: Nat -> CRealSequence
-> Nat -> CRealError bounds
-> CReal
A basic general limit which takes as arguments a sequence of reals and a sequence of error bounds.
limRec
:: CRealinitial value
-> CReal -> Nat -> (CReal, CReal)a function which produces a pair, (next element, error estimate) from previous one and location
-> CReal
Similar to lim, but can sometimes be more convenient for some sequences
limRat
:: Nat -> DyadicSequence of dyadics
-> Nat -> DyadicSequence of (dyadic) error bounds
-> CReal
Limit of a sequence of rationals.
infSum
:: Nat -> CRealSequence of reals
-> Nat -> CRealSequence of series remainders
-> CReal
Computes an infinite sum of a series
infSumRec :: CReal -> (CReal -> Nat -> (CReal, CReal)) -> CReal
Similar to infSum but can sometimes be more convenient Second argument is a_0
approx :: CReal -> Nat -> Either (Dyadic, Word) Dyadic

approx x n tries to compute a dyadic approximation to x so than |x - d| <= 10^(-n) If it succeeds it returns Right d where d is a dyadic rational, otherwise it returns Left (d, n) where d is a dyadic rational and n is the number of accurate decimal places

Approx succeeds if result can be computed with precision less than the square of the number of required bits of precision.

pCompare :: CReal -> CReal -> Nat -> POrdering
pCompare x y returns a function Nat -> POrdering which when applied to some n computes approximates with precision n and then compares the resulting intervals
(<.) :: CReal -> CReal -> Nat -> PBool
x <. y is a function Nat -> PBool which, when applied to some n , computes the approximation with precision n and then compares the intervals. If intervals are disjoint then result is either PTrue or PFalse, otherwise result is Indeterminate.
(>.) :: CReal -> CReal -> Nat -> PBool
Similar to (<.)
sqrt :: CReal -> CReal
exp :: CReal -> CReal
log :: CReal -> CReal
fromDyadic :: Dyadic -> CReal
fromInt :: Int -> CReal
fromInt should be preferred over fromIntegral where applicable
fromWord :: Word -> CReal
fromWord should be preferred over fromIntegral where applicable
fromString :: String -> CReal
toString :: Nat -> CReal -> String
toString computes the result with specified precision.
toStringDec :: Nat -> CReal -> String
toStringDec tries to compute the result to the number of specified significand digits
Produced by Haddock version 2.2.2