fp-ieee-0.1.0.6: IEEE 754-2019 compliant operations
Safe HaskellNone
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}\).

Instances

Instances details
RealFloatNaN Double Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.NaN

Methods

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 # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.NaN

Methods

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 #

equalByTotalOrder :: Float -> Float -> Bool Source #

compareByTotalOrder :: Float -> Float -> Ordering Source #

data Class Source #

The classification of floating-point values.

Instances

Instances details
Enum Class Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.Classify

Read Class Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.Classify

Methods

readsPrec :: Int -> ReadS Class

readList :: ReadS [Class]

readPrec :: ReadPrec Class

readListPrec :: ReadPrec [Class]

Show Class Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.Classify

Methods

showsPrec :: Int -> Class -> ShowS

show :: Class -> String

showList :: [Class] -> ShowS

Eq Class Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.Classify

Methods

(==) :: Class -> Class -> Bool

(/=) :: Class -> Class -> Bool

Ord Class Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.Classify

Methods

compare :: Class -> Class -> Ordering

(<) :: Class -> Class -> Bool

(<=) :: Class -> Class -> Bool

(>) :: Class -> Class -> Bool

(>=) :: Class -> Class -> Bool

max :: Class -> Class -> Class

min :: Class -> Class -> Class

newtype TotallyOrdered a Source #

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

Constructors

TotallyOrdered a 

Instances

Instances details
Show a => Show (TotallyOrdered a) Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.NaN

Methods

showsPrec :: Int -> TotallyOrdered a -> ShowS

show :: TotallyOrdered a -> String

showList :: [TotallyOrdered a] -> ShowS

RealFloatNaN a => Eq (TotallyOrdered a) Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.NaN

Methods

(==) :: TotallyOrdered a -> TotallyOrdered a -> Bool

(/=) :: TotallyOrdered a -> TotallyOrdered a -> Bool

RealFloatNaN a => Ord (TotallyOrdered a) Source # 
Instance details

Defined in Numeric.Floating.IEEE.Internal.NaN