Float package:classy-prelude
Single-precision floating point numbers. It is desirable that this
type be at least equal in range and precision to the IEEE
single-precision type.
Trigonometric and hyperbolic functions and related functions.
The Haskell Report defines no laws for
Floating. However,
(+),
(*) and
exp are
customarily expected to define an exponential field and have the
following properties:
- exp (a + b) = exp a * exp b
- exp (fromInteger 0) = fromInteger 1
a constant function, returning the number of digits of
floatRadix in the significand
a constant function, returning the radix of the representation (often
2)
a constant function, returning the lowest and highest values the
exponent may assume
Efficient, machine-independent access to the components of a
floating-point number.
The function
decodeFloat applied to a real floating-point
number returns the significand expressed as an
Integer and an
appropriately scaled exponent (an
Int). If
decodeFloat x yields
(m,n), then
x
is equal in value to
m*b^^n, where
b is the
floating-point radix, and furthermore, either
m and
n are both zero or else
b^(d-1) <= abs m <
b^d, where
d is the value of
floatDigits
x. In particular,
decodeFloat 0 = (0,0). If the
type contains a negative zero, also
decodeFloat (-0.0) =
(0,0).
The result of decodeFloat x is
unspecified if either of isNaN x or
isInfinite x is True.
encodeFloat performs the inverse of
decodeFloat in the
sense that for finite
x with the exception of
-0.0,
uncurry encodeFloat (decodeFloat x) = x.
encodeFloat m n is one of the two closest
representable floating-point numbers to
m*b^^n (or
±Infinity if overflow occurs); usually the closer, but if
m contains too many bits, the result may be rounded in the
wrong direction.
multiplies a floating-point number by an integer power of the radix