pow -- Compute Power

Format

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

Language Level: ANSI, POSIX, XPG4
pow calculates the value of x to the power of y.

Return Value
If y is 0, pow returns the value 1. If x is 0 and y is negative, pow sets errno to EDOM and returns 0. If both x and y are 0, or if x is negative and y is not an integer, pow sets errno to EDOM, and returns 0.

If an overflow results, pow sets errno to ERANGE and returns +HUGE_VAL for a positive result or -HUGE_VAL for a negative result.

Example
This example calculates the value of 2³.

#include <math.h>
#include <stdio.h>
int main(void)
{
   double x, y, z;
   x = 2.0;
   y = 3.0;
   z = pow(x,y);
   printf("%lf to the power of %lf is %lf\n", x, y, z);
   return 0;
   /****************************************************
      The output should be:
      2.000000 to the power of 3.000000 is 8.000000
   ****************************************************/
}


exp -- Calculate Exponential Function
_fsqrt -- Calculate Square Root
log -- Calculate Natural Logarithm
log10 -- Calculate Base 10 Logarithm
sqrt -- Calculate Square Root
<math.h>