Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

frexp, frexpf, frexpl - extract mantissa and exponent from double precision number

&pagelevel(4)&pagelevel

Syntax

#include <math.h>

double frexp(double num, int *exp);
C11
float frexpf(float num, int *exp);
long double frexpl(long double num, int *exp); (End)

Description

These functions split a floating-point value num into the mantissa x and the exponent exp using the formula:

num = x * 2exp

|x| is in the interval [0.5, 1.0]

exp is a pointer to an integer that specifies the exponent to the base 2.

frexp() is the inverse function of ldexp().

Return val.

Mantissa x

a floating-point number of the function-type that lies in the interval [0.5, 1.0] and satisfies the equation: num = x * 2exp. The exponent is stored in exp.

0

if num is equal to 0 (in which case the exponent is also equal to 0).

Notes

An application wishing to check for error situations should set errno to 0 before calling frexp(). If errno is set on return, an error has occurred.

See also

ldexp(), modf(), math.h.