fp-ieee-0.1.0.4: IEEE 754-2019 compliant operations
Safe HaskellSafe-Inferred
LanguageHaskell2010

Numeric.Floating.IEEE.NaN

Description

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

Documentation

class RealFloat a => RealFloatNaN a where Source #

An instance of this class supports manipulation of NaN.

Methods

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.

Warning: GHC's optimizer is not aware of signaling NaNs.

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.

Floating-point numbers should be ordered as, \(-\mathrm{qNaN} < -\mathrm{sNaN} < -\infty < \text{negative reals} < -0 < +0 < \text{positive reals} < +\infty < +\mathrm{sNaN} < +\mathrm{qNaN}\).

data Class Source #

The classification of floating-point values.

newtype TotallyOrdered a Source #

A newtype wrapper to compare floating-point numbers by totalOrder predicate.

Constructors

TotallyOrdered a