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 Floating Point 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.
— Function: float frexpf (float value, int *exponent)
— Function: long double frexpl (long double value, int *exponent)
These functions are 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
— Function: float ldexpf (float value, int exponent)
— Function: long double ldexpl (long double value, int exponent)
These functions return the result of multiplying the floating-point number value by 2 raised to the power exponent. (It can be used to reassemble floating-point numbers that were taken apart by
ldexp (0.8, 4)returns
The following functions, which come from BSD, provide facilities
equivalent to those of
frexp. See also the
ISO C function
logb which originally also appeared in BSD.
— Function: long long int significandf (float x)