ieee-0.6.1: Approximate comparisons for IEEE floating point numbers

Stabilityexperimental
MaintainerPatrick Perry <patperry@gmail.com>

Data.AEq

Description

A type class for approximate and exact equalilty comparisons and instances for common data types.

Documentation

class Eq a => AEq a whereSource

Methods

(===) :: a -> a -> BoolSource

A reliable way to test if two values are exactly equal. For floating point values, this will consider NaN to be (===) to NaN.

(~==) :: a -> a -> BoolSource

An approximate equality comparison operator. For RealFloat values, (~==) x y = (x == y) || (abs (x - y) < epsilon) || (eqRel delta x y) || (isNaN x && isNaN y). For Complex numbers, the if the real and imaginary parts are not approximately equal, the polar forms are compared, instead.

Instances

AEq Bool 
AEq Char 
AEq Double 
AEq Float 
AEq Int 
AEq Int8 
AEq Int16 
AEq Int32 
AEq Int64 
AEq Integer 
AEq Ordering 
AEq Word 
AEq Word8 
AEq Word16 
AEq Word32 
AEq Word64 
AEq () 
AEq CChar 
AEq CSChar 
AEq CUChar 
AEq CShort 
AEq CUShort 
AEq CInt 
AEq CUInt 
AEq CLong 
AEq CULong 
AEq CLLong 
AEq CULLong 
AEq CFloat 
AEq CDouble 
AEq CPtrdiff 
AEq CSize 
AEq CWchar 
AEq CSigAtomic 
AEq CClock 
AEq CTime 
AEq CIntPtr 
AEq CUIntPtr 
AEq CIntMax 
AEq CUIntMax 
AEq a => AEq [a] 
RealFloat a => AEq (Complex a) 
AEq a => AEq (Maybe a) 
(AEq a, AEq b) => AEq (Either a b) 
(AEq a, AEq b) => AEq (a, b) 
(AEq a, AEq b, AEq c) => AEq (a, b, c) 
(AEq a, AEq b, AEq c, AEq d) => AEq (a, b, c, d) 
(AEq a, AEq b, AEq c, AEq d, AEq e) => AEq (a, b, c, d, e)