atan、atanf、atanl、atan2、atan2f、atan2l

计算 x 的反正切值 ( atan atanf 和  atanl ) 或 y / x  的反正切值 ( atan2 atan2f 和  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
);

xy

任何数量。

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>\n", av[0] );
      return 1;
   }
   x = atof( av[1] );
   theta = atan( x );
   printf( "Arctangent of %f: %f\n", x, theta );
   y = atof( av[2] );
   theta = atan2( y, x );
   printf( "Arctangent of %f / %f: %f\n", y, x, theta ); 
   return 0;
}
  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值