Next: gamma, Previous: fmod, Up: Math

### 1.19 `frexp`, `frexpf`—split floating-point number

Synopsis

         #include <math.h>
         double frexp(double val, int *exp);
         float frexpf(float val, int *exp);

Description
All nonzero, normal numbers can be described as m * 2**p. `frexp` represents the double val as a mantissa m and a power of two p. The resulting mantissa will always be greater than or equal to `0.5`, and less than `1.0` (as long as val is nonzero). The power of two will be stored in `*`exp.

m and p are calculated so that val is m times `2` to the power p.

`frexpf` is identical, other than taking and returning floats rather than doubles.

Returns
`frexp` returns the mantissa m. If val is `0`, infinity, or Nan, `frexp` will set `*`exp to `0` and return val.

Portability
`frexp` is ANSI. `frexpf` is an extension.