frexpf


Divide floating-point number into mantissa and power

[Classification]

Mathematical library

[Syntax]

#include <mathf.h>

float frexpf(float val, int *exp);

[Return value]

Returns mantissa m.

frexpf sets 0 to *exp and returns 0 if val is 0.

If val is +, frexpf returns zero and sets macro EDOM to global variable errno.

[Description]

This function expresses val of float type as mantissa m and the pth power of 2. The resulting mantissa m is 0.5 <= | x | < 1.0, unless val is zero. p is stored in *exp. m and p are calculated so that val = m * 2 p.

[Example]

#include    <mathf.h>
void func(void) {
        float   ret, x;
        int     exp;
        x = 5.28;
        ret = frexpf(x, &exp);  /*Resultant mantissa 0.66 is returned to ret, and 3 is
                                  stored in exp.*/
          :
}