atan、atanf、atanl、atan2、atan2f、atan2l
2024-10-21 05:53:48
很久不发博客了,今天在园中计算各种角,于是复习下fan正切函数
计算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
);
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++ 允许重载,可以调用 atan和atan2重载函数。 在 C 程序中,atan 和 atan2 始终采用并返回两个。
例程 |
必需的标头 |
---|---|
atan, atan2, atanf, atan2f, atanl, atan2l |
<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;
}
最新文章
- iOS widget开发
- 前端基础 JavaScript~~~ 数据处理 奇技淫巧!!!!!!
- ECMAScript 6教程 (二) 对象和函数
- Apache配置代理服务器的方法(1)
- 拆分ABBYY FineReader 12文档的方法
- hdu - 2216 Game III &;&; xtu 1187 Double Maze (两个点的普通bfs)
- core&mdash;线程与IO
- 如何开发原生的 JavaScript 插件(知识点+写法)
- 将excel数据导入内表的函数
- 超酷创意HTML5动画演示及代码
- 360云后台(使用HTTP Cache服务器)
- Linux学习之chage命令
- Ubuntu14.04 Y460闪屏问题解决方案
- TreeSet源码分析
- UVAlive 3708 Graveyard(最优化问题)
- Python 3.3.2 round函数并非";四舍五入";
- lvm语法2
- node.js 远程调试debug产线环境代码
- MongoDB数据库去重
- Python文档记录
热门文章
- 【2019.11.27】SDN课程阅读作业(2)
- updateprimarykey 和updateprimaryKeySelective
- PyCharm虚拟环(Project Interpreter)手动安装第三方包图解教程
- C#使用SHA1加密类(RSAFromPkcs8)支持1024位和2048位私钥
- Git push origin dev-rgq-istokenstatus 【dev-rgq-istokenstatus ->; dev-rgq-istokenstatus】
- 运行 puppeteer 报错 chrome: error while loading shared libraries: libpangocairo-1.0.so.0: cannot open shared object file: No such file or directory
- 决策树分析、EMV(期望货币值)
- WebGL学习笔记(五):变换库
- matlab学习笔记9 高级绘图命令_1 图形对象_根对象,轴对象,用户控制对象,用户菜单对象
- [LeetCode] 369. Plus One Linked List 链表加一运算