linear-1.0.1: Linear Algebra

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Linear.Epsilon

Description

Testing for values near zero

Synopsis

Documentation

class Num a => Epsilon a whereSource

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 -> BoolSource

Determine if a quantity is near zero.

Instances

Epsilon Double
abs a <= 1e-12
Epsilon Float
abs a <= 1e-6
Epsilon a => Epsilon (V0 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)