acos、acosf、acosl |
您所在的位置:网站首页 › c语言acos是什么意思 › acos、acosf、acosl |
acos, acosf, acosl
项目10/15/2023
计算反余弦值。 语法 double acos( double x ); float acosf( float x ); long double acosl( long double x ); #define acos(X) // Requires C11 or higher float acos( float x ); // C++ only long double acos( long double x ); // C++ only 参数x -1 到 1 之间的值,将为其计算反余弦值。 返回值acos 函数返回 0 到 π 弧度范围内的 x 的反余弦值。 默认情况下,如果 x 小于 -1 或大于 1,acos 将返回无穷大。 输入 SEH 异常 _matherr 异常 ± INF INVALID _DOMAIN ± QNaN、IND 无 _DOMAIN |x| > 1 INVALID _DOMAIN 备注由于 C++ 支持重载,您可以调用采用并返回 acos 和 float 类型的 long double 的重载。 在 C 程序中,除非你使用 宏来调用此函数,否则 acos 始终采用并返回 double。 如果使用 中的 acos 宏,自变量的类型将确定选择哪个版本的函数。 有关详细信息,请参阅泛型类型数学。 默认情况下,此函数的全局状态范围限定为应用程序。 若要更改此行为,请参阅 CRT 中的全局状态。 要求 例程 必需的标头 可选标头 acos, acosf, acosl acos 宏 示例此程序提示 -1 到 1 范围内的值。 此范围之外的输入值将产生 _DOMAIN 错误消息。 如果输入了有效值,此程序将输出该值的反正弦值和反余弦值。 // crt_asincos.c // arguments: 0 #include #include #include #include int main( int ac, char* av[] ) { double x, y; errno_t err; // argument checking if (ac != 2) { fprintf_s( stderr, "Usage: %s \n", av[0]); return 1; } // Convert argument into a double value if ((err = sscanf_s( av[1], "%lf", &x )) != 1) { fprintf_s( stderr, "Error converting argument into ", "double value.\n"); return 1; } // Arcsine of X y = asin( x ); printf_s( "Arcsine of %f = %f\n", x, y ); // Arccosine of X y = acos( x ); printf_s( "Arccosine of %f = %f\n", x, y ); } Arcsine of 0.000000 = 0.000000 Arccosine of 0.000000 = 1.570796 另请参阅数学和浮点支持 asin、asinf、asinl atan、atanf、atanl、atan2、atan2f、atan2l cos、cosf、cosl _matherr sin、sinf、sinl tan、tanf、tanl |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |