当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


C语言 atan()用法及代码示例

此函数提供计算值的反正切值的函数。该值应小于等于 Ď€/2 且大于等于 -Ď€/2。

该函数以单个参数作为需要计算其反正切值的数字,并返回计算结果的值。

例:

    X = 0.7
    The function will return 0.610726

这个函数是一部分math.h库,它必须包含在程序中。

math.h - C 中的 atan() 函数示例


#include <stdio.h>
#include <math.h>

int main()
{
    // Defining variables
    double a,b;

    // Assigning value for getting atan value
    a = 0.7;

    // Calculating the arc tangent of a
    b = atan(a);

    // Displaying the result for user
    printf("The calculated value is:%lf \n\n", b);

    return 0;
}

输出

math.h - atan()  in c language



相关用法


注:本文由纯净天空筛选整理自Manu Jemini大神的英文原创作品 atan() function of math.h in C。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。