HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleieee754-0.8.0Haskell98

Numeric.IEEE

Operations on IEEE floating point numbers.

  • 1 class
  • 4 values
  • Packageieee754-0.8.0
  • Exports5
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceIEEE.hs

IEEE type class

1 declaration
classclass RealFloat a => IEEE a where
#

IEEE floating point types.

Methods

  • infinity :: a

    Infinity value.

  • minDenormal :: a

    The smallest representable positive value.

  • minNormal :: a

    The smallest representable positive normalized value.

  • maxFinite :: a

    The largest representable finite value.

  • epsilon :: a

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

  • copySign :: a -> a -> a

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

  • identicalIEEE :: a -> a -> Bool

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

  • succIEEE :: a -> a

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

  • predIEEE :: a -> a

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

  • bisectIEEE :: a -> a -> a

    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

    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

    Default NaN value.

  • nanWithPayload :: Word64 -> a

    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

    Maximum NaN payload for type a.

  • nanPayload :: a -> Word64

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

Instances4IEEE
  • IEEE CDoubleDefined in ieee754-0.8.0 · Numeric.IEEE
  • IEEE CFloatDefined in ieee754-0.8.0 · Numeric.IEEE
  • IEEE DoubleDefined in ieee754-0.8.0 · Numeric.IEEE
  • IEEE FloatDefined in ieee754-0.8.0 · Numeric.IEEE

NaN-aware minimum and maximum

4 declarations
valueminNum :: RealFloat a => a -> a -> a
#

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

valuemaxNum :: RealFloat a => a -> a -> a
#

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

valueminNaN :: RealFloat a => a -> a -> a
#

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

valuemaxNaN :: RealFloat a => a -> a -> a
#

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