Copyright | Copyright (c) 2010 Patrick Perry <patperry@gmail.com> |
---|---|
License | BSD3 |
Maintainer | Patrick Perry <patperry@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell98 |
Data.AEq
Description
A type class for approximate and exact equalilty comparisons and instances for common data types.
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 CChar Source # | |
AEq CClock Source # | |
AEq CDouble Source # | |
AEq CFloat Source # | |
AEq CInt Source # | |
AEq CIntMax Source # | |
AEq CIntPtr Source # | |
AEq CLLong Source # | |
AEq CLong Source # | |
AEq CPtrdiff Source # | |
AEq CSChar Source # | |
AEq CShort Source # | |
AEq CSigAtomic Source # | |
AEq CSize Source # | |
AEq CTime Source # | |
AEq CUChar Source # | |
AEq CUInt Source # | |
AEq CUIntMax Source # | |
AEq CUIntPtr Source # | |
AEq CULLong Source # | |
AEq CULong Source # | |
AEq CUShort Source # | |
AEq CWchar Source # | |
AEq IntPtr Source # | |
AEq WordPtr Source # | |
AEq Int16 Source # | |
AEq Int32 Source # | |
AEq Int64 Source # | |
AEq Int8 Source # | |
AEq Word16 Source # | |
AEq Word32 Source # | |
AEq Word64 Source # | |
AEq Word8 Source # | |
AEq Ordering Source # | |
AEq Integer Source # | |
AEq () Source # | |
AEq Bool Source # | |
AEq Char Source # | |
AEq Double Source # | |
AEq Float Source # | |
AEq Int Source # | |
AEq Word Source # | |
AEq (Complex CDouble) Source # | |
AEq (Complex CFloat) Source # | |
AEq (Complex Double) Source # | |
AEq (Complex Float) Source # | |
AEq (ForeignPtr a) Source # | |
AEq (FunPtr a) Source # | |
AEq (Ptr a) Source # | |
AEq (StablePtr a) Source # | |
AEq a => AEq (Maybe a) Source # | |
AEq a => AEq [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 # | |