ieee-0.3: Approximate comparisons for IEEE floating point numbers

MaintainerPatrick Perry <>



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


class Eq a => AEq a whereSource


(===) :: 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.


AEq Bool 
AEq Double 
AEq Float 
AEq Int 
AEq Int8 
AEq Int16 
AEq Int32 
AEq Int64 
AEq Word 
AEq Word8 
AEq Word16 
AEq Word32 
AEq Word64 
AEq () 
AEq a => AEq [a] 
(RealFloat a, AEq 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) 

compareListsWith :: (a -> a -> Bool) -> [a] -> [a] -> BoolSource