Name

pow

Synopsis

Raises a number to a power

#include <math.h>
doublepow( double x, double y );
float powf( float x, float y );        (C99)
long double powl( long double x, long double y );        (C99)

The pow() function calculates x to the power of y. In other words, the return value is xy. The arguments are subject to the following rules:

  • If x is negative, y must have an integer value.

  • If x is zero, then y must not be negative. (00 = 1.0, but for all other positive values of y, 0y = 0.0.)

If the arguments violate these conditions, pow() may return NaN (not a number) or infinity, and may indicate a domain error. If an overflow or underflow occurs, pow() returns positive or negative HUGE_VAL and may indicate a range error.

Example

See the example for cosh() in this chapter.

See Also

exp(), sqrt(), cpow()

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.