Safe Haskell | None |
---|---|

Language | Haskell2010 |

This module provides the typeclass for NaN manipulation: `RealFloatNaN`

.

In addition to `Float`

and `Double`

, a couple of floating-point types provided by third-party libraries can be supported via package flags: `Half`

via `half`

and `Float128`

via `float128`

.

## Synopsis

- class RealFloat a => RealFloatNaN a where
- copySign :: a -> a -> a
- isSignMinus :: a -> Bool
- isSignaling :: a -> Bool
- getPayload :: a -> a
- setPayload :: a -> a
- setPayloadSignaling :: a -> a
- classify :: a -> Class
- equalByTotalOrder :: a -> a -> Bool
- compareByTotalOrder :: a -> a -> Ordering

- data Class
- newtype TotallyOrdered a = TotallyOrdered a

# Documentation

class RealFloat a => RealFloatNaN a where Source #

An instance of this class supports manipulation of NaN.

copySign :: a -> a -> a Source #

Returns the first operand, with the sign of the second.

IEEE 754 `copySign`

operation.

isSignMinus :: a -> Bool Source #

Returns `True`

if the operand is a negative number, negative infinity, negative zero, or a NaN with negative sign bit.

IEEE 754 `isSignMinus`

operation.

isSignaling :: a -> Bool Source #

Returns `True`

if the operand is a signaling NaN.

IEEE 754 `isSignaling`

operation.

getPayload :: a -> a Source #

Returns the payload of a NaN.
Returns `-1`

if the operand is not a NaN.

IEEE 754 `getPayload`

operation.

setPayload :: a -> a Source #

Returns a quiet NaN with a given payload. Returns a positive zero if the payload is invalid.

IEEE 754 `setPayload`

operation.

setPayloadSignaling :: a -> a Source #

Returns a signaling NaN with a given payload. Returns a positive zero if the payload is invalid.

IEEE 754 `setPayloadSignaling`

operation.

classify :: a -> Class Source #

IEEE 754 `class`

operation.

equalByTotalOrder :: a -> a -> Bool Source #

Equality with IEEE 754 `totalOrder`

operation.

compareByTotalOrder :: a -> a -> Ordering Source #

Comparison with IEEE 754 `totalOrder`

operation.

#### Instances

RealFloatNaN Double Source # | |

Defined in Numeric.Floating.IEEE.Internal.NaN copySign :: Double -> Double -> Double Source # isSignMinus :: Double -> Bool Source # isSignaling :: Double -> Bool Source # getPayload :: Double -> Double Source # setPayload :: Double -> Double Source # setPayloadSignaling :: Double -> Double Source # classify :: Double -> Class Source # equalByTotalOrder :: Double -> Double -> Bool Source # compareByTotalOrder :: Double -> Double -> Ordering Source # | |

RealFloatNaN Float Source # | |

Defined in Numeric.Floating.IEEE.Internal.NaN copySign :: Float -> Float -> Float Source # isSignMinus :: Float -> Bool Source # isSignaling :: Float -> Bool Source # getPayload :: Float -> Float Source # setPayload :: Float -> Float Source # setPayloadSignaling :: Float -> Float Source # classify :: Float -> Class Source # |

The classification of floating-point values.

SignalingNaN | |

QuietNaN | |

NegativeInfinity | |

NegativeNormal | |

NegativeSubnormal | |

NegativeZero | |

PositiveZero | |

PositiveSubnormal | |

PositiveNormal | |

PositiveInfinity |

newtype TotallyOrdered a Source #

A newtype wrapper to compare floating-point numbers by `totalOrder`

predicate.

#### Instances

RealFloatNaN a => Eq (TotallyOrdered a) Source # | |

Defined in Numeric.Floating.IEEE.Internal.NaN (==) :: TotallyOrdered a -> TotallyOrdered a -> Bool # (/=) :: TotallyOrdered a -> TotallyOrdered a -> Bool # | |

RealFloatNaN a => Ord (TotallyOrdered a) Source # | |

Defined in Numeric.Floating.IEEE.Internal.NaN compare :: TotallyOrdered a -> TotallyOrdered a -> Ordering # (<) :: TotallyOrdered a -> TotallyOrdered a -> Bool # (<=) :: TotallyOrdered a -> TotallyOrdered a -> Bool # (>) :: TotallyOrdered a -> TotallyOrdered a -> Bool # (>=) :: TotallyOrdered a -> TotallyOrdered a -> Bool # max :: TotallyOrdered a -> TotallyOrdered a -> TotallyOrdered a # min :: TotallyOrdered a -> TotallyOrdered a -> TotallyOrdered a # | |

Show a => Show (TotallyOrdered a) Source # | |

Defined in Numeric.Floating.IEEE.Internal.NaN showsPrec :: Int -> TotallyOrdered a -> ShowS # show :: TotallyOrdered a -> String # showList :: [TotallyOrdered a] -> ShowS # |