Important: The information in this document is obsolete and should not be used for new development.
frexp
You can use thefrexpfunction to find out the values of a floating-point number's fraction field and exponent field.
double_t frexp (double_t x, int *exponent);
x- Any floating-point number.
exponent- A pointer to an integer in which the value of the exponent can be returned.
DESCRIPTION
Thefrexpfunction splits its first argument into a fraction part and a base 2 exponent part. This is an ANSI standard C library function.such that
or
such that and
The return value of
frexpis the value of the fraction field of the argumentx. The exponent field ofxis stored in the address pointed to by theexponentargument.For finite nonzero inputs,
frexpreturns either 0.0 or a value whose magnitude is between 0.5 and 1.0.The
ldexpandscalbfunctions perform the inverse operation (compute ).EXCEPTIONS
If x is finite and nonzero, the result of is exact.SPECIAL CASES
Table 10-13 shows the results when the input argument to thefrexpfunction is a zero, a NaN, or an Infinity.
Special cases for the frexpfunctionOperation Result Exceptions raised +0 (n = 0) None (n = 0) None NaN (n is undefined) None[34] + (n is undefined)
None (n is undefined) None EXAMPLES
z = frexp(2E300, n); /* z0.746611 and n = 998. In other words, 2 10300
0.746611 2998. */
[34] If the NaN is a signaling NaN, the invalid exception is raised.