Data.AEq

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

Copyright | Copyright (c) 2010, Patrick Perry <patperry@gmail.com>
License | BSD3
Maintainer | Patrick Perry <patperry@gmail.com>
Stability | experimental
Safe Haskell | None
Language | Haskell98

Data.AEq

Description

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

Synopsis

- class Eq a => AEq a where

# Documentation

class Eq a => AEq a where #

Types with approximate and exact equality comparisons.

Methods

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

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 #

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