pow -- Compute the Value of the Power Function

SYNOPSIS

 #include <math.h>

 double pow(double x, double y);
 

DESCRIPTION

pow computes the value of x raised to the power y, as expressed by this relation:
 r = x**y
 

RETURN VALUE

pow returns the value of its argument x raised to the power y. The result is a double-precision, floating-point number.

DIAGNOSTICS

If x**y is too large to be represented, the run-time library writes an error message to the standard error file (stderr) and returns +- HUGE_VAL. If x**y is too small to be represented, the run-time library writes an error message to the standard error file (stderr) and returns 0.0.

For a negative value of x and a noninteger y, the function returns 0.0, and the run-time library writes an error message to stderr. For x == 0.0 and negative y, the function returns HUGE_VAL, and the run-time library writes an error message to stderr.

If an error occurs in pow, the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

EXAMPLE

This example finds the cube root of 17, using pow:
  #include <math.h>
  #include <stdio.h>

  main()
  {
     double x, y, f;

     x = 17.0;
     y = 1.0/3.0;
     f = pow(x, y);
     printf("(pow(%f,%f)) = %fn", x, y, f);
  }

 

RELATED FUNCTIONS

exp, _matherr

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.