pow

Returns the first argument raised to the power of the second argument.

Format

#include  <math.h>

double pow  (double base, double exp);

Arguments

base
A value of type double that is to be raised to a power.
exp
The exponent to which the power base is to be raised.

Description

Both arguments must be double and the returned value is double.

Return Values
The result of the first argument raised to the power of the second. 
1.0  Indicates that the base is zero and the exponent is zero. 
HUGE_VAL  Indicates that the result overflowed; errno is set to ERANGE. 
-HUGE_VAL  Indicates that the base is zero and the exponent is negative; errno is set to EDOM. 

Example

    #include <stdio.h>
    #include <math.h>
    
    main()
    {
    double x;
     errno=0;
    
     x = pow(-3.0, 2.0);
     printf("%d, %f\n", errno, x);
    }
    


Previous Page | Next Page | Table of Contents | Index