Copyright | Copyright (c) 2010 Patrick Perry <patperry@gmail.com> |
---|---|
License | BSD3 |
Maintainer | Patrick Perry <patperry@gmail.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
Operations on IEEE floating point numbers.
IEEE type class
class RealFloat a => IEEE a where Source #
IEEE floating point types.
infinity, minDenormal, minNormal, maxFinite, epsilon, copySign, identicalIEEE, succIEEE, predIEEE, bisectIEEE, sameSignificandBits, nan, nanWithPayload, maxNaNPayload, nanPayload
Infinity value.
minDenormal :: a Source #
The smallest representable positive value.
The smallest representable positive normalized value.
The largest representable finite value.
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.
Return the next largest IEEE value (Infinity
and NaN
are
unchanged).
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
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
.
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
.