This function is compatible with the following targets:
|
|
#include <math.h>
double pow(double x, double y);
float powf(float, float x);
long double powl(long double, long double x);Parameters:
Parameters for this function are:
pow() returns xy. The pow() function may assign EDOM to errno if x is 0.0 and y is less than or equal to zero or if x is less than zero and y is not an integer. See "Floating point error testing.," for information on newer error testing procedures.
"Example usage of error detection,"
pow() example:#include <math.h>
#include <stdio.h>
int main(void)
{
double x;
printf("Powers of 2:\n");
for (x = 1.0; x <= 10.0; x += 1.0)
printf("2 to the %4.0f is %4.0f.\n", x, pow(2, x));
return 0;
}
Output:
Powers of 2:
2 to the 1 is 2.
2 to the 2 is 4.
2 to the 3 is 8.
2 to the 4 is 16.
2 to the 5 is 32.
2 to the 6 is 64.
2 to the 7 is 128.
2 to the 8 is 256.
2 to the 9 is 512.
2 to the 10 is 1024.
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000