[Previous]
[Contents]
[Next]

pow()

raise a number to the power of another

Synopsis:

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

Description:

The pow() function computes x raised to the power y. A domain error occurs if x is zero, and y is less than or equal to 0, or if x is negative, and y is not an integer. A range error may occur.

Returns:

The value of x raised to the power y.

When the argument is outside the permissible range, the matherr() function is called. Unless the default matherr() function is replaced, it will set the global variable errno to EDOM, and print a "DOMAIN error" diagnostic message using the stderr stream.

Examples:

#include <stdio.h>
#include <math.h>

void main()
  {
    printf( "%f\n", pow( 1.5, 2.5 ) );
  }

produces the output:

2.755676

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, exp(), log(), matherr(), sqrt()


[Previous]
[Contents]
[Next]