Copyright | (c) Michal Konecny |
---|---|
License | BSD3 |
Maintainer | mikkonecny@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Tests for operations on arbitrary precision floats.
To run the tests using stack, execute:
stack test aern2-mp --test-arguments "-a 1000"
Or to run only MPFloat tests, execute:
stack test aern2-mp --test-arguments "-a 1000 -m MPFloat"
Synopsis
- specMPFloat :: Spec
- tMPFloat :: T MPFloat
- enforceRangeMP :: (Maybe Integer, Maybe Integer) -> MPFloat -> MPFloat
- approxEqual :: Integer -> MPFloat -> MPFloat -> Bool
- approxEqualWithArgs :: Integer -> [(MPFloat, MPFloat, String)] -> MPFloat -> MPFloat -> Property
- frequencyElements :: ConvertibleExactly t Int => [(t, a)] -> Gen a
Documentation
specMPFloat :: Spec Source #
tMPFloat :: T MPFloat Source #
A runtime representative of type MPFloat
.
Used for specialising polymorphic tests to concrete types.
enforceRangeMP :: (Maybe Integer, Maybe Integer) -> MPFloat -> MPFloat Source #
enforceRange (Just l, Just u) a
where l < u
returns an arbitrary value b
with u < b < l
.
Moreover, the returned values are distributed roughly evenly if the input values a
are distributed
roughly evenly in a large neighbourhood of the interval [l,r]
.
In most cases, when l<a<u
, then b=a
.
Assert equality of two MPFloat's with tolerance 1/2^p
.
:: Integer | bits of extra precision loss allowed |
-> [(MPFloat, MPFloat, String)] | intermediate values from which to determine tolerance, their names to report when the equality fails |
-> MPFloat | LHS of equation |
-> MPFloat | RHS of equation |
-> Property |
Assert equality of two MPFloat's with tolerance derived from the given list of input and intermediate values and their differentials (ie the derivative of the result wrt this value). The difference in the left and right results is expected to share at least as many significant digits as the worst error step among the input and intermediate numbers shifted by the slope of the differential minus the given precision loss parameter.
When the assertion fails, report the given values using the given names.
frequencyElements :: ConvertibleExactly t Int => [(t, a)] -> Gen a Source #