Next: pow10, Previous: nextafter, Up: Math [Contents][Index]

### 1.46 `pow`, `powf`—x to the power y

Synopsis

    #include <math.h>
    double pow(double x, double y);
    float powf(float x, float y);

Description
`pow` and `powf` calculate x raised to the exponent y.

Returns
On success, `pow` and `powf` return the value calculated.

When the argument values would produce overflow, `pow` returns `HUGE_VAL` and set `errno` to `ERANGE`. If the argument x passed to `pow` or `powf` is a negative noninteger, and y is also not an integer, then `errno` is set to `EDOM`. If x and y are both 0, then `pow` and `powf` return `1`.

You can modify error handling for these functions using `matherr`.

Portability
`pow` is ANSI C. `powf` is an extension.