Home > Backend Development > C#.Net Tutorial > What is the usage of pow function in C language?

What is the usage of pow function in C language?

烟雨青岚
Release: 2020-06-28 16:59:01
Original
64211 people have browsed it

In the C language, the pow() function is used to find the y power of x. x, y and function values ​​are all double type, and their syntax is "double pow(double x, double y)"; the parameter "double x" represents the base; the parameter "double y" represents the exponent.

What is the usage of pow function in C language?

pow() function is used to find the y power of x. x, y and function values ​​are all double type, and its prototype is: double pow(double x, double y).

The example code is as follows:

#include<stdio.h>
#include<math.h>
void main()
{
double x = 2, y = 10;
printf("%f\n",pow(x, y));
return 0;
}
Copy after login

What is the usage of pow function in C language?

##Extended information:

When calling the pow function, errors may occur:

If the base x is a negative number and the exponent y is not an integer, a domain error will occur.

If the base x and the exponent y are both 0, it may cause a domain error? error, or it may not; this is related to the implementation of the library.

If the base x is 0 and the exponent y is a negative number, it may cause a domain error or pole error, or it may not; this is related to the implementation of the library.

If the return value ret is too large or too small, a range error will occur.

Error code:

If a domain error occurs, then the global variable errno will be set to EDOM;

If a pole error or range error occurs, then the global variable errno will be set to ERANGE.

Recommended tutorial: "

C Language"

The above is the detailed content of What is the usage of pow function in C language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template