首页 > 代码库 > atan2 atan
atan2 atan
atan2 definition
In terms of the standard arctan function, whose range is (?π/2, π/2), it can be expressed as follows:
- 0 \\ \arctan\left(\frac y x\right) + \pi& \qquad y \ge 0 , x < 0 \\ \arctan\left(\frac y x\right) - \pi& \qquad y < 0 , x < 0 \\ +\frac{\pi}{2} & \qquad y > 0 , x = 0 \\ -\frac{\pi}{2} & \qquad y < 0 , x = 0 \\ \text{undefined} & \qquad y = 0, x = 0 \end{cases}" src="http://upload.wikimedia.org/math/5/7/1/571efb70f630041f9e2b00019025171e.png">
-
Notes:
- This produces results in the range (?π, π], which can be mapped to [0, 2π) by adding 2π to negative results.
- Traditionally, atan2(0, 0) is undefined.
- The C function atan2, and most other computer implementations, are designed to reduce the effort of transforming cartesian to polar coordinates and so always define atan2(0, 0). On implementations without signed zero, or when given positive zero arguments, it is normally defined as 0. It will always return a value in the range [?π, π] rather than raising an error or returning a NaN (Not a Number).
- Systems supporting symbolic mathematics normally return an undefined value for atan2(0,0) or otherwise signal that an abnormal condition has arisen.
- For systems implementing signed zero, infinities, or Not a Number (for example, IEEE floating point), it is common to implement reasonable extensions which may extend the range of values produced to include ?π and ?0. These also may return NaN or raise an exception when given a NaN argument.
- For systems implementing signed zero (for example, IEEE floating point), atan2(-0, x), x < 0 returns the value ?π. atan2(+0, x), x < 0 still returns +π.
atan
interval is (-pi/2,pi/2)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。