sparse-linear-algebra-0.3.1: Numerical computing in native Haskell

Copyright (C) 2016 Marco Zocca 2012-2015 Edward Kmett GPL-3 (see LICENSE) zocca.marco gmail provisional portable Safe Haskell2010

Numeric.Eps

Description

Testing for values "near" zero

Synopsis

# 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


Minimal complete definition

nearZero

Methods

nearZero :: a -> Bool Source #

Determine if a quantity is near zero.

Instances

 Source # abs a <= 1e-12 Methods Source # abs a <= 1e-6 Methods Source # abs a <= 1e-6 Methods Source # abs a <= 1e-12 Methods Source # magnitude a <= 1e-12 Methods Source # magnitude a <= 1e-6 Methods Source # magnitude a <= 1e-6 Methods Source # magnitude a <= 1e-12 Methods

isNz :: Epsilon a => a -> Bool Source #

Is this quantity distinguishable from 0 ?

roundZero :: Epsilon a => a -> a Source #

roundOne :: Epsilon a => a -> a Source #

roundZeroOne :: Epsilon a => a -> a Source #

Round to respectively 0 or 1

nearOne :: Epsilon a => a -> Bool Source #

Is this quantity close to 1 ?