Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Computation with high-precision floats.
Synopsis
- data BigFloat
- bfPosZero :: BigFloat
- bfNegZero :: BigFloat
- bfPosInf :: BigFloat
- bfNegInf :: BigFloat
- bfNaN :: BigFloat
- bfFromWord :: Word64 -> BigFloat
- bfFromInt :: Int64 -> BigFloat
- bfFromDouble :: Double -> BigFloat
- bfFromInteger :: Integer -> BigFloat
- bfFromString :: Int -> BFOpts -> String -> (BigFloat, Status)
- bfToDouble :: RoundMode -> BigFloat -> (Double, Status)
- bfToString :: Int -> ShowFmt -> BigFloat -> String
- bfToRep :: BigFloat -> BFRep
- data BFRep
- data BFNum
- bfIsFinite :: BigFloat -> Bool
- bfIsZero :: BigFloat -> Bool
- bfIsNaN :: BigFloat -> Bool
- bfCompare :: BigFloat -> BigFloat -> Ordering
- bfSign :: BigFloat -> Maybe Sign
- bfExponent :: BigFloat -> Maybe Int64
- data Sign
- bfNeg :: BigFloat -> BigFloat
- bfAdd :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status)
- bfSub :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status)
- bfMul :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status)
- bfDiv :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status)
- bfMulWord :: BFOpts -> BigFloat -> Word64 -> (BigFloat, Status)
- bfMulInt :: BFOpts -> BigFloat -> Int64 -> (BigFloat, Status)
- bfMul2Exp :: BFOpts -> BigFloat -> Int64 -> (BigFloat, Status)
- bfSqrt :: BFOpts -> BigFloat -> (BigFloat, Status)
- bfPow :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status)
- bfRoundFloat :: BFOpts -> BigFloat -> (BigFloat, Status)
- bfRoundInt :: BFOpts -> BigFloat -> (BigFloat, Status)
- bfUnsafeThaw :: BigFloat -> BF
- bfUnsafeFreeze :: BF -> BigFloat
- module LibBF.Opts
Constants
Arbitrary precision floating point numbers.
Conversions
bfFromWord :: Word64 -> BigFloat Source #
A floating point number corresponding to the given word.
bfFromDouble :: Double -> BigFloat Source #
A floating point number corresponding to the given double.
bfFromInteger :: Integer -> BigFloat Source #
A floating point number corresponding to the given integer.
Parse a number from the given string. Returns @NaN` if the string does not correspond to a number we recognize.
Render as a String
, using the given settings.
An explicit representation for big nums.
Representations for unsign floating point numbers.
Predicates
bfIsFinite :: BigFloat -> Bool Source #
Is this a "normal" (i.e., non-infinite, non NaN) number.
bfCompare :: BigFloat -> BigFloat -> Ordering Source #
Compare the two numbers. The special values are ordered like this:
- -0 < 0
- NaN == NaN
- NaN is larger than all other numbers
Note that this differs from `(<=)`
bfExponent :: BigFloat -> Maybe Int64 Source #
Get the exponent for the given number. Infinity, zero and NaN do not have an exponent.
Indicates if a number is positive or negative.
Arithmetic
bfAdd :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status) Source #
Add two numbers useing the given options.
bfSub :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status) Source #
Subtract two numbers useing the given options.
bfMul :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status) Source #
Multiply two numbers using the given options.
bfDiv :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status) Source #
Divide two numbers useing the given options.
bfMulWord :: BFOpts -> BigFloat -> Word64 -> (BigFloat, Status) Source #
Multiply a number and a word, using the given options.
bfMulInt :: BFOpts -> BigFloat -> Int64 -> (BigFloat, Status) Source #
Multiply a number and an int, using the given options.
bfSqrt :: BFOpts -> BigFloat -> (BigFloat, Status) Source #
Square root of two numbers useing the given options.
bfPow :: BFOpts -> BigFloat -> BigFloat -> (BigFloat, Status) Source #
Exponentiate a word to a positive integer power.
Rounding
bfRoundFloat :: BFOpts -> BigFloat -> (BigFloat, Status) Source #
Round to a float matching the input parameters.
bfRoundInt :: BFOpts -> BigFloat -> (BigFloat, Status) Source #
Round to an integer using the given parameters.
Mutability
bfUnsafeThaw :: BigFloat -> BF Source #
Make a number mutable. WARNING: This does not copy the number, so it could break referential transperancy.
bfUnsafeFreeze :: BF -> BigFloat Source #
Make a number immutable. WARNING: This does not copy the number, so it could break referential transperancy.
Limits
Configuration
module LibBF.Opts