linear-1.20.7: Linear Algebra

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
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

Minimal complete definition

nearZero

Methods

nearZero :: a -> Bool Source #

Determine if a quantity is near zero.

Instances

Epsilon Double Source #
abs a <= 1e-12

Methods

nearZero :: Double -> Bool Source #

Epsilon Float Source #
abs a <= 1e-6

Methods

nearZero :: Float -> Bool Source #

Epsilon CFloat Source #
abs a <= 1e-6

Methods

nearZero :: CFloat -> Bool Source #

Epsilon CDouble Source #
abs a <= 1e-12
Epsilon (V0 a) Source # 

Methods

nearZero :: V0 a -> Bool Source #

Epsilon a => Epsilon (V1 a) Source # 

Methods

nearZero :: V1 a -> Bool Source #

Epsilon a => Epsilon (V2 a) Source # 

Methods

nearZero :: V2 a -> Bool Source #

Epsilon a => Epsilon (V3 a) Source # 

Methods

nearZero :: V3 a -> Bool Source #

Epsilon a => Epsilon (V4 a) Source # 

Methods

nearZero :: V4 a -> Bool Source #

Epsilon a => Epsilon (Plucker a) Source # 

Methods

nearZero :: Plucker a -> Bool Source #

(RealFloat a, Epsilon a) => Epsilon (Quaternion a) Source # 
Epsilon (f a) => Epsilon (Point f a) Source # 

Methods

nearZero :: Point f a -> Bool Source #

(Dim k n, Epsilon a) => Epsilon (V k n a) Source # 

Methods

nearZero :: V k n a -> Bool Source #