futhark-data-1.1.2.0: An implementation of the Futhark data format.

Safe Haskell | None
Language | Haskell2010

Futhark.Data.Compare

Description

Facilities for comparing values for equality. While `Eq` instances are defined, these are not useful when NaNs are involved, and do not *explain* the differences.

Synopsis

- compareValues :: Tolerance -> Value -> Value -> [Mismatch]
- compareSeveralValues :: Tolerance -> [Value] -> [Value] -> [Mismatch]
- newtype Tolerance = Tolerance Double
- data Mismatch

# Documentation

compareValues :: Tolerance -> Value -> Value -> [Mismatch] Source #

Compare two Futhark values for equality.

compareSeveralValues :: Tolerance -> [Value] -> [Value] -> [Mismatch] Source #

As `compareValues`, but compares several values. The two lists must have the same length.

newtype Tolerance Source #

The maximum relative tolerance used for comparing floating-point results. 0.002 (0.2%) is a fine default if you have no particular opinion.

Constructors

Tolerance Double |

#### Instances

Instances details

Show Tolerance Source # |
Instance details Defined in Futhark.Data.Compare Methods showsPrec :: Int -> Tolerance -> ShowS Source # show :: Tolerance -> String Source # showList :: [Tolerance] -> ShowS Source #
Eq Tolerance Source # |
Instance details Defined in Futhark.Data.Compare Methods (==) :: Tolerance -> Tolerance -> Bool Source # (/=) :: Tolerance -> Tolerance -> Bool Source #
Ord Tolerance Source # |

Instance details

Defined in Futhark.Data.Compare

Methods

compare :: Tolerance -> Tolerance -> Ordering Source #

(<) :: Tolerance -> Tolerance -> Bool Source #

(<=) :: Tolerance -> Tolerance -> Bool Source #

(>) :: Tolerance -> Tolerance -> Bool Source #

(>=) :: Tolerance -> Tolerance -> Bool Source #

max :: Tolerance -> Tolerance -> Tolerance Source #

min :: Tolerance -> Tolerance -> Tolerance Source #

data Mismatch Source #

Two values differ in some way. The `Show` instance produces a human-readable explanation.

#### Instances

Instances details

Show Mismatch Source # |
Instance details Defined in Futhark.Data.Compare Methods showsPrec :: Int -> Mismatch -> ShowS Source # show :: Mismatch -> String Source # showList :: [Mismatch] -> ShowS Source #