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

CopyrightCopyright (c) 2010 Patrick Perry <patperry@gmail.com>
LicenseBSD3
MaintainerPatrick Perry <patperry@gmail.com>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

Numeric.IEEE

Contents

Description

Operations on IEEE floating point numbers.

Synopsis

IEEE type class

class RealFloat a => IEEE a where Source #

IEEE floating point types.

Methods

infinity :: a Source #

Infinity value.

minDenormal :: a Source #

The smallest representable positive value.

minNormal :: a Source #

The smallest representable positive normalized value.

maxFinite :: a Source #

The largest representable finite value.

epsilon :: a Source #

The smallest positive value x such that 1 + x is representable.

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

copySign x y returns x with its sign changed to y's.

identicalIEEE :: a -> a -> Bool Source #

Return True if two values are exactly (bitwise) equal.

succIEEE :: a -> a Source #

Return the next largest IEEE value (Infinity and NaN are unchanged).

predIEEE :: a -> a Source #

Return the next smallest IEEE value (-Infinity and NaN are unchanged).

bisectIEEE :: a -> a -> a Source #

Given two values with the same sign, return the value halfway between them on the IEEE number line. If the signs of the values differ or either is NaN, the value is undefined.

sameSignificandBits :: a -> a -> Int Source #

The number of significand bits which are equal in the two arguments (equivalent to feqrel from the Tango Math library). The result is between 0 and floatDigits.

nan :: a Source #

Default NaN value.

nanWithPayload :: Word64 -> a Source #

Quiet NaN value with a positive integer payload. Payload must be less than maxNaNPayload. Beware that while some platforms allow using 0 as a payload, this behavior is not portable.

maxNaNPayload :: a -> Word64 Source #

Maximum NaN payload for type a.

nanPayload :: a -> Word64 Source #

The payload stored in a NaN value. Undefined if the argument is not NaN.

Instances
IEEE Double Source # 
Instance details

Defined in Numeric.IEEE

Methods

infinity :: Double Source #

minDenormal :: Double Source #

minNormal :: Double Source #

maxFinite :: Double Source #

epsilon :: Double Source #

copySign :: Double -> Double -> Double Source #

identicalIEEE :: Double -> Double -> Bool Source #

succIEEE :: Double -> Double Source #

predIEEE :: Double -> Double Source #

bisectIEEE :: Double -> Double -> Double Source #

sameSignificandBits :: Double -> Double -> Int Source #

nan :: Double Source #

nanWithPayload :: Word64 -> Double Source #

maxNaNPayload :: Double -> Word64 Source #

nanPayload :: Double -> Word64 Source #

IEEE Float Source # 
Instance details

Defined in Numeric.IEEE

Methods

infinity :: Float Source #

minDenormal :: Float Source #

minNormal :: Float Source #

maxFinite :: Float Source #

epsilon :: Float Source #

copySign :: Float -> Float -> Float Source #

identicalIEEE :: Float -> Float -> Bool Source #

succIEEE :: Float -> Float Source #

predIEEE :: Float -> Float Source #

bisectIEEE :: Float -> Float -> Float Source #

sameSignificandBits :: Float -> Float -> Int Source #

nan :: Float Source #

nanWithPayload :: Word64 -> Float Source #

maxNaNPayload :: Float -> Word64 Source #

nanPayload :: Float -> Word64 Source #

IEEE CDouble Source # 
Instance details

Defined in Numeric.IEEE

Methods

infinity :: CDouble Source #

minDenormal :: CDouble Source #

minNormal :: CDouble Source #

maxFinite :: CDouble Source #

epsilon :: CDouble Source #

copySign :: CDouble -> CDouble -> CDouble Source #

identicalIEEE :: CDouble -> CDouble -> Bool Source #

succIEEE :: CDouble -> CDouble Source #

predIEEE :: CDouble -> CDouble Source #

bisectIEEE :: CDouble -> CDouble -> CDouble Source #

sameSignificandBits :: CDouble -> CDouble -> Int Source #

nan :: CDouble Source #

nanWithPayload :: Word64 -> CDouble Source #

maxNaNPayload :: CDouble -> Word64 Source #

nanPayload :: CDouble -> Word64 Source #

IEEE CFloat Source # 
Instance details

Defined in Numeric.IEEE

Methods

infinity :: CFloat Source #

minDenormal :: CFloat Source #

minNormal :: CFloat Source #

maxFinite :: CFloat Source #

epsilon :: CFloat Source #

copySign :: CFloat -> CFloat -> CFloat Source #

identicalIEEE :: CFloat -> CFloat -> Bool Source #

succIEEE :: CFloat -> CFloat Source #

predIEEE :: CFloat -> CFloat Source #

bisectIEEE :: CFloat -> CFloat -> CFloat Source #

sameSignificandBits :: CFloat -> CFloat -> Int Source #

nan :: CFloat Source #

nanWithPayload :: Word64 -> CFloat Source #

maxNaNPayload :: CFloat -> Word64 Source #

nanPayload :: CFloat -> Word64 Source #

NaN-aware minimum and maximum

minNum :: RealFloat a => a -> a -> a Source #

Return the minimum of two values; if one value is NaN, return the other. Prefer the first if both values are NaN.

maxNum :: RealFloat a => a -> a -> a Source #

Return the maximum of two values; if one value is NaN, return the other. Prefer the first if both values are NaN.

minNaN :: RealFloat a => a -> a -> a Source #

Return the minimum of two values; if one value is NaN, return it. Prefer the first if both values are NaN.

maxNaN :: RealFloat a => a -> a -> a Source #

Return the maximum of two values; if one value is NaN, return it. Prefer the first if both values are NaN.