powf


Power function

[Classification]

Mathematical library

[Syntax]

#include <mathf.h>

float powf(float x, float y);

[Return value]

Returns the yth power of x.

powf returns a negative solution only if x < 0 and y is an odd integer. If x < 0 and y is a non-integer or if x = y = 0, powf returns a NaN and sets the macro EDOM for the global variable errno. If x = 0 and y < 0 or if an overflow occurs, powf returns +HUGE_VAL and sets the macro ERANGE for errno. If the solution vanished approaching zero, powf returns 0 and sets the macro ERANGE for errno. If the solution is a denormal number, powf sets the macro ERANGE for errno.

[Description]

This function calculates the yth power of x.

[Example]

#include    <mathf.h>
float func(void) {
        float   ret, x, y;
        ret = powf(x, y);   /*Returns yth power of x to ret.*/
          :
        return(ret);
}