• atan、atanf、atanl、atan2、atan2f、atan2l


    很久不发博客了,今天在园中计算各种角,于是复习下fan正切函数
    计算x的反正切值 (atanatanf和 atanl) 或y/x 的反正切值 (atan2atan2f和 atan2l)。
     
     
    double atan( 
       double x 
    );
    float atan(
       float x 
    );  // C++ only
    long double atan(
       long double x
    );  // C++ only
    double atan2( 
       double y, 
       double x 
    );
    float atan2(
       float y,
       float x
    );  // C++ only
    long double atan2(
       long double y,
       long double x
    );  // C++ only
    float atanf( 
       float x 
    );
    long double atanl(
       long double x
    );
    float atan2f(
       float y,
       float x
    );
    long double atan2l(
       long double y,
       long double x
    );
    

     

    参数
     
    x, y

    任何数量。

    返回值

     
    atan 返回 x –π/2 到π/2弧度范围内的反正切值。 atan2 返回 y/x –π/2 到π/2弧度范围内的反正切值。如果 x 为0,则 atan返回0 。 如果 atan2 的参数都是 0,则函数返回 0。 所有结果以弧度为单位。

    atan2 使用两个参数的符号标识确定返回值的象限。

     

    输入

    SEH 异常

    Matherr 异常

    ± QNAN,IND

    _DOMAIN

    备注
     

    atan 函数求x的反正切值 (反正切函数) 。 atan2 计算 y/x 反正切值 (如果 x 等于 0,atan2 返回π/2,如果 y 为正数的,-π/2,如果 y 为负或 0,则 y 为 0。)

    atan 具有使用Streaming SIMD Extensions 2(SSE2)的实现。 有关使用SSE2实现的信息和限制,请参见_set_SSE2_enable

    由于 C++ 允许重载,可以调用 atanatan2重载函数。 在 C 程序中,atan 和 atan2 始终采用并返回两个。

     

    要求
     
     

    例程

    必需的标头

    atanatan2atanfatan2fatanlatan2l

    <math.h>

     

    示例
     
     
     
    // crt_atan.c
    // arguments: 5 0.5
    #include <math.h>
    #include <stdio.h>
    #include <errno.h>
    
    int main( int ac, char* av[] ) 
    {
       double x, y, theta;
       if( ac != 3 ){
          fprintf( stderr, "Usage: %s <x> <y>
    ", av[0] );
          return 1;
       }
       x = atof( av[1] );
       theta = atan( x );
       printf( "Arctangent of %f: %f
    ", x, theta );
       y = atof( av[2] );
       theta = atan2( y, x );
       printf( "Arctangent of %f / %f: %f
    ", y, x, theta ); 
       return 0;
    }
  • 相关阅读:
    SVN 安装 使用指南
    使用angular-cli快速搭建项目命令
    angular 路由的引用
    c#默认类的修饰符。
    c#
    js改变dom对象样式
    jquery常用函数
    PHP 文件上传
    php 表单代码
    Python 条件语句
  • 原文地址:https://www.cnblogs.com/baitongtong/p/8214371.html
Copyright © 2020-2023  润新知