The functions described in this section are primarily provided as a way to efficiently perform certain low-level manipulations on floating point numbers that are represented internally using a binary radix; see section Floating Point Representation Concepts. These functions are required to have equivalent behavior even if the representation does not use a radix of 2, but of course they are unlikely to be particularly efficient in those cases.
All these functions are declared in `math.h'.
frexpfunction is used to split the number value into a normalized fraction and an exponent.
If the argument value is not zero, the return value is value
times a power of two, and is always in the range 1/2 (inclusive) to 1
(exclusive). The corresponding exponent is stored in
*exponent; the return value multiplied by 2 raised to this
exponent equals the original number value.
frexp (12.8, &exponent) returns
If value is zero, then the return value is zero and
zero is stored in
ldexp (0.8, 4) returns
The following functions which come from BSD provide facilities
equivalent to those of
scalbfunction is the BSD name for
double. This is the highest integer power of
2contained in x. The sign of x is ignored. For example,
2 raised to this power is divided into x, it gives a
1 (inclusive) and
If x is zero, the value is minus infinity (if the machine supports such a value), or else a very small number. If x is infinity, the value is infinity.
The value returned by
logb is one less than the value that
frexp would store into
copysignfunction returns a value whose absolute value is the same as that of value, and whose sign matches that of sign. This is a BSD function.
Go to the first, previous, next, last section, table of contents.