hypot ()- 计算阳痿
格式
#include <math.h>
double hypot(double side1, double side2);语言级别
ANSI
线程安全
是
描述
hypot() 函数根据两侧 side1 和 side2的长度计算直角三角形的斜边长度。 对 hypot() 函数的调用等效于: sqrt(side1 * side1 + side2 * side2);返回值
hypot() 函数返回阳痿的长度。 如果溢出结果, hypot() 会将 errno 设置为 ERANGE 并返回值 HUGE_VAL。 如果下流结果,那么 hypot() 会将 errno 设置为 ERANGE 并返回零。 errno 的值也可以设置为 EDOM。
示例
此示例计算以 3.0 和 4.0为边的直角三角形的斜角。
#include <math.h>
int main(void)
{
double x, y, z;
x = 3.0;
y = 4.0;
z = hypot(x,y);
printf("The hypotenuse of the triangle with sides %lf and %lf"
" is %lf\n", x, y, z);
}
/******************** Output should be similar to: **************
The hypotenuse of the triangle with sides 3.000000 and 4.000000 is 5.000000
*/