Copyright | (C) 2016 Marco Zocca 2012-2015 Edward Kmett |
---|---|
License | GPL-3 (see LICENSE) |
Maintainer | zocca.marco gmail |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Testing for values "near" zero
Documentation
class (Floating a, Num a) => Epsilon a where Source #
Provides a test to see if a quantity is near zero.
>>>
nearZero (1e-11 :: Double)
False
>>>
nearZero (1e-17 :: Double)
True
>>>
nearZero (1e-5 :: Float)
False
>>>
nearZero (1e-7 :: Float)
True
roundZeroOne :: Epsilon a => a -> a Source #
Round to respectively 0 or 1