linear-1.15.5: Linear Algebra

Copyright(C) 2012 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell98

Linear.Epsilon

Description

Testing for values "near" zero

Synopsis

Documentation

class Num a => Epsilon a where Source

Provides a fairly subjective 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

Methods

nearZero :: a -> Bool Source

Determine if a quantity is near zero.

Instances

Epsilon Double
abs a <= 1e-12
Epsilon Float
abs a <= 1e-6
Epsilon CFloat
abs a <= 1e-6
Epsilon CDouble
abs a <= 1e-12
Epsilon a => Epsilon (V0 a) 
Epsilon a => Epsilon (V1 a) 
Epsilon a => Epsilon (V2 a) 
Epsilon a => Epsilon (V3 a) 
Epsilon a => Epsilon (V4 a) 
Epsilon a => Epsilon (Plucker a) 
(RealFloat a, Epsilon a) => Epsilon (Quaternion a) 
Epsilon (f a) => Epsilon (Point f a) 
(Dim k n, Epsilon a) => Epsilon (V k n a)