Safe Haskell | None |
---|---|
Language | Haskell2010 |
Configuration and results for FP computation.
Synopsis
- data BFOpts = BFOpts !LimbT !FlagsT
- allowSubnormal :: BFOpts
- float16 :: RoundMode -> BFOpts
- float32 :: RoundMode -> BFOpts
- float64 :: RoundMode -> BFOpts
- float128 :: RoundMode -> BFOpts
- float256 :: RoundMode -> BFOpts
- precBits :: Int -> BFOpts
- precBitsMin :: Int
- precBitsMax :: Int
- infPrec :: BFOpts
- expBits :: Int -> BFOpts
- expBitsMin :: Int
- expBitsMax :: Int
- rnd :: RoundMode -> BFOpts
- newtype RoundMode = RoundMode FlagsT
- pattern NearEven :: RoundMode
- pattern ToZero :: RoundMode
- pattern ToNegInf :: RoundMode
- pattern ToPosInf :: RoundMode
- pattern NearAway :: RoundMode
- pattern Away :: RoundMode
- pattern Faithful :: RoundMode
- data ShowFmt = ShowFmt !LimbT !FlagsT
- showRnd :: RoundMode -> ShowFmt
- showFixed :: Word64 -> ShowFmt
- showFrac :: Word64 -> ShowFmt
- showFree :: Maybe Word64 -> ShowFmt
- showFreeMin :: Maybe Word64 -> ShowFmt
- addPrefix :: ShowFmt
- forceExp :: ShowFmt
- radixMax :: Int
- newtype Status = Status CInt
- pattern Ok :: Status
- pattern InvalidOp :: Status
- pattern DivideByZero :: Status
- pattern Overflow :: Status
- pattern Underflow :: Status
- pattern Inexact :: Status
- pattern MemError :: Status
- type LimbT = Word64
- type SLimbT = Int64
- type FlagsT = Word32
Options
Specifies various computation settings, combined with Semigroup
.
allowSubnormal :: BFOpts Source #
Allow denormalized answers.
Presets
Precision
precBits :: Int -> BFOpts Source #
Use this many bits to represent the mantissa in the computation.
The input should be in the interval defined by precMin
and precMax
precBitsMin :: Int Source #
The smallest supported precision (in bits).
precBitsMax :: Int Source #
The largest supported precision (in bits). Memory could run out before we run out of precision.
Use infinite precision. This should be used with caution, as it could exhause memory, and at the moment the library does not handle this gracefully at all (core dumps).
Exponent Size
expBits :: Int -> BFOpts Source #
Set how many bits to use to represent the exponent.
Should fit in the range defined by expBitsMin
and expBitsMax
.
expBitsMin :: Int Source #
The smallest supported number of bits in the exponent.
expBitsMax :: Int Source #
The largest number of exponent bits supported.
Rounding mode
rnd :: RoundMode -> BFOpts Source #
Use the given rounding mode.
If none is specified, then the default is NearEven
.
Specifies how to round when the result can't be precise.
Pretty printing options
Settings for rendering numbers as String
.
showFree :: Maybe Word64 -> ShowFmt Source #
Use as many digits as necessary to match the required precision
rounding to nearest and the subnormal+exponent configuration of FlagsT
.
The result is meaningful only if the input is already rounded to
the wanted precision.
Infinite precision, indicated by giving Nothing
for the precision
is supported when the radix is a power of two.
showFreeMin :: Maybe Word64 -> ShowFmt Source #
same as showFree
but uses the minimum number of digits
(takes more computation time).
add 0x prefix for base 16, 0o prefix for base 8 or 0b prefix for base 2 if non zero value
Status
A set of flags indicating things that might go wrong.
pattern DivideByZero :: Status Source #
We divided by zero.