ieee754-0.7.8: Utilities for dealing with IEEE floating point numbers

CopyrightCopyright (c) 2010, Patrick Perry <patperry@gmail.com>
LicenseBSD3
MaintainerPatrick Perry <patperry@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Data.AEq

Description

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

Synopsis

Documentation

class Eq a => AEq a where Source

Types with approximate and exact equality comparisons.

Minimal complete definition

Nothing

Methods

(===) :: a -> a -> Bool infix 4 Source

An exact equality comparison.

For real IEEE types, two values are equivalent in the following cases:

  • both values are +0;
  • both values are -0;
  • both values are nonzero and equal to each other (according to ==);
  • both values are NaN with the same payload and sign.

For complex IEEE types, two values are equivalent if their real and imaginary parts are equivalent.

(~==) :: a -> a -> Bool infix 4 Source

An approximate equality comparison operator.

For real IEEE types, two values are approximately equal in the following cases:

  • at least half of their significand bits agree;
  • both values are less than epsilon;
  • both values are NaN.

For complex IEEE types, two values are approximately equal in the followiing cases:

  • their magnitudes are approximately equal and the angle between them is less than 32*epsilon;
  • both magnitudes are less than epsilon;
  • both have a NaN real or imaginary part.

Admitedly, the 32 is a bit of a hack. Future versions of the library may switch to a more principled test of the angle.

Instances

AEq Bool Source 
AEq Char Source 
AEq Double Source 
AEq Float Source 
AEq Int Source 
AEq Int8 Source 
AEq Int16 Source 
AEq Int32 Source 
AEq Int64 Source 
AEq Integer Source 
AEq Ordering Source 
AEq Word Source 
AEq Word8 Source 
AEq Word16 Source 
AEq Word32 Source 
AEq Word64 Source 
AEq () Source 
AEq WordPtr Source 
AEq IntPtr Source 
AEq CChar Source 
AEq CSChar Source 
AEq CUChar Source 
AEq CShort Source 
AEq CUShort Source 
AEq CInt Source 
AEq CUInt Source 
AEq CLong Source 
AEq CULong Source 
AEq CLLong Source 
AEq CULLong Source 
AEq CFloat Source 
AEq CDouble Source 
AEq CPtrdiff Source 
AEq CSize Source 
AEq CWchar Source 
AEq CSigAtomic Source 
AEq CClock Source 
AEq CTime Source 
AEq CIntPtr Source 
AEq CUIntPtr Source 
AEq CIntMax Source 
AEq CUIntMax Source 
AEq a => AEq [a] Source 
AEq (StablePtr a) Source 
AEq (Ptr a) Source 
AEq (FunPtr a) Source 
AEq (Complex Double) Source 
AEq (Complex Float) Source 
AEq (Complex CFloat) Source 
AEq (Complex CDouble) Source 
AEq (ForeignPtr a) Source 
AEq a => AEq (Maybe a) Source 
(AEq a, AEq b) => AEq (Either a b) Source 
(AEq a, AEq b) => AEq (a, b) Source 
(AEq a, AEq b, AEq c) => AEq (a, b, c) Source 
(AEq a, AEq b, AEq c, AEq d) => AEq (a, b, c, d) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e) => AEq (a, b, c, d, e) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f) => AEq (a, b, c, d, e, f) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g) => AEq (a, b, c, d, e, f, g) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h) => AEq (a, b, c, d, e, f, g, h) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i) => AEq (a, b, c, d, e, f, g, h, i) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j) => AEq (a, b, c, d, e, f, g, h, i, j) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j, AEq k) => AEq (a, b, c, d, e, f, g, h, i, j, k) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j, AEq k, AEq l) => AEq (a, b, c, d, e, f, g, h, i, j, k, l) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j, AEq k, AEq l, AEq m) => AEq (a, b, c, d, e, f, g, h, i, j, k, l, m) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j, AEq k, AEq l, AEq m, AEq n) => AEq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) Source 
(AEq a, AEq b, AEq c, AEq d, AEq e, AEq f, AEq g, AEq h, AEq i, AEq j, AEq k, AEq l, AEq m, AEq n, AEq o) => AEq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) Source