atan2: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
Returned value is in degrees, in the range -180 to +180, using the signs of both parameters to determine the quadrant of the return value. | Returned value is in degrees, in the range -180 to +180, using the signs of both parameters to determine the quadrant of the return value. | ||
Positive angles are clockwise and negative angles are counter-clockwise. | |||
Line 28: | Line 30: | ||
_angle = 5 '''atan2''' 3 ..........Result is 59.0362 | _angle = 5 '''atan2''' 3 ..........Result is 59.0362 | ||
'''Notes:'''<br> | |||
'''atan2''' is safer than the alternative [[atan]]. This is because '''atan2''' will correctly return the angle when the tangent is infinite:<br> | |||
1 '''atan2''' 0<br> | |||
will correctly return the answer 90.<br> | |||
[[atan]] 1/0 will return a Divide by Zero Error |
Revision as of 16:43, 21 May 2006
x atan2 y
Operand types:
x: Number
y: Number
Type of returned value:
Description:
Returns the arctangens of x/y.
Returned value is in degrees, in the range -180 to +180, using the signs of both parameters to determine the quadrant of the return value.
Positive angles are clockwise and negative angles are counter-clockwise.
Example:
_angle = 5 atan2 3 ..........Result is 59.0362
Notes:
atan2 is safer than the alternative atan. This is because atan2 will correctly return the angle when the tangent is infinite:
1 atan2 0
will correctly return the answer 90.
atan 1/0 will return a Divide by Zero Error