#include <math.h> double pow(double x, double y);
pow
computes the value of x
raised to the power y
, as
expressed by this relation:
r = x**y
pow
returns the value of its argument x
raised to the power
y
. The result is a double-precision, floating-point number.
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.
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); }
exp
, _matherr
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.