cpow
Power function
Interface
#include <math.h>
double | pow (double x, double y) |
long | powl (long double x, long double y) |
float | powf (float x, float y) |
#include <complex.h>
double complex | cpow (double complex x, complex double y) |
float complex | cpowf (float complex x, complex float y) |
long double complex | cpowl (long double complex x, complex long double y) |
Description
The pow functions compute x raised to the power of y, i.e.Example:
Example - Power function
Workings
#include <math.h> #include <stdio.h> int main(void) { for(int i = 1; i < 5; i++) printf("pow(3.2, %d) = %lf\n", i, pow(3.2, i)); return 0; }
Solution
Output:
pow(3.2, 1) = 3.200000 pow(3.2, 2) = 10.240000 pow(3.2, 3) = 32.768000 pow(3.2, 4) = 104.857600