double frexp (double x, int* exp);
double frexp (double x , int* exp); float frexpf (float x , int* exp);long double frexpl (long double x, int* exp);
double frexp (double x , int* exp); float frexp (float x , int* exp);long double frexp (long double x, int* exp);
double frexp (double x , int* exp); float frexp (float x , int* exp);long double frexp (long double x, int* exp); double frexp (T x , int* exp); // additional overloads for integral types
Get significand and exponent
Breaks the floating point number x into its binary significand (a floating point with an absolute value between
1.0(excluded)) and an integral exponent for
2, such that:
x = significand * 2 exponent
The exponent is stored in the location pointed by exp, and the significand is the value returned by the function.
If x is zero, both parts (significand and exponent) are zero.
If x is negative, the significand returned by this function is negative.
provides a type-generic macro version of this function.
are provided in this header (
) for the integral types
: These overloads effectively cast x
before calculations (defined for T
being any integral type
- Value to be decomposed.
- Pointer to an
int where the value of the exponent is stored.
The binary significand of x.
This value is the floating point value whose absolute value lays in the interval
[0.5,1) which, once multiplied by
2 raised to the power of exp, yields x.
/* frexp example */
#include <stdio.h> /* printf */
#include <math.h> /* frexp */
int main ()
double param, result;
param = 8.0;
result = frexp (param , &n);
printf ("%f = %f * 2^%d\n", param, result, n);
8.000000 = 0.500000 * 2^4
- Generate value from significand and exponent (function)
- Compute natural logarithm (function)
- Raise to power (function)