| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Order.Float
Contents
Synopsis
- open :: Float -> Float -> Interval Float
- openl :: Float -> Float -> Interval Float
- openr :: Float -> Float -> Interval Float
- covers :: Float -> Float -> Bool
- indexFromTo :: Interval Float -> [Float]
- ulp :: Float -> Float -> Maybe (Ordering, Word32)
- shift :: Int32 -> Float -> Float
- within :: Word32 -> Float -> Float -> Bool
- lower32 :: Preorder a => Float -> (Float -> a) -> a -> Float
- upper32 :: Preorder a => Float -> (Float -> a) -> a -> Float
- minimal :: Float
- maximal :: Float
- epsilon :: Float
Documentation
open :: Float -> Float -> Interval Float Source #
Construnct an open interval.
>>>contains 1 $ open 1 2False>>>contains 2 $ open 1 2False
openl :: Float -> Float -> Interval Float Source #
Construnct a half-open interval.
>>>contains 1 $ openl 1 2False>>>contains 2 $ openl 1 2True
openr :: Float -> Float -> Interval Float Source #
Construnct a half-open interval.
>>>contains 1 $ openr 1 2True>>>contains 2 $ openr 1 2False
covers :: Float -> Float -> Bool Source #
Covering relation on the N5 lattice of floats.
https://en.wikipedia.org/wiki/Covering_relation
>>>covers 1 (shift 1 1)True>>>covers 1 (shift 2 1)False
indexFromTo :: Interval Float -> [Float] Source #
Generate a list of the contents on an interval.
Returns the list of values in the interval defined by a bounding pair.
Lawful variant of enumFromTo.
ulp :: Float -> Float -> Maybe (Ordering, Word32) Source #
Compute the signed distance between two floats in units of least precision.
>>>ulp 1.0 (shift 1 1.0)Just (LT,1)>>>ulp (0.0/0.0) 1.0Nothing
shift :: Int32 -> Float -> Float Source #
Shift a float by n units of least precision.
>>>shift 1 01.0e-45>>>shift 1 $ 0/0NaN>>>shift (-1) $ 0/0NaN>>>shift 1 $ 1/0Infinity
within :: Word32 -> Float -> Float -> Bool Source #
Compare two floats for approximate equality.
Required accuracy is specified in units of least precision.
See also https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/.
Maximum finite value.
>>>maximal3.4028235e38>>>shift 1 maximalInfinity>>>shift (-1) $ negate maximal-Infinity
Difference between 1 and the smallest representable value greater than 1.
epsilon = shift 1 1 - 1
>>>epsilon1.1920929e-7