Implementation status: partially implemented


#include <math.h>

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


The function breaks the floating point number num into its binary significant

  • (a floating point with an absolute value between 0.5(included) and 1.0(excluded))
  • an integral power of 2.


num - a floating point number to be broken,
exp - an integer exponent.

Return value

For finite arguments, these functions return the value x, such that x has a magnitude in the interval [½,1) or 0, and num equals x times 2 raised to the power *exp.

If num is NaN, a NaN is returned, and the value of *exp is unspecified.

If num is ±0, ±0 is returned, and the value of *exp is 0.

If num is ±Inf, num is returned, and the value of *exp is unspecified.


No errors are defined.

Implementation tasks

  • frexp(): remove strange constant: 1022.
  • normalizeSub(): remove strange constants from the code.
  • Implement frexpf().
  • Implement frexpl().