-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Math.atan2() should not return "inverse tangent of ny / nx" #2897
Comments
Step 12 was introduced by PR #2122. Before that, the specification of
(plus a bunch of edge-cases for which particular values were required). PR #2122 should perhaps have used wording closer to that for step 12. |
I find this quite vague, isn't it? It doesn't tell me which quadrant the result is in, for each sign combination. |
Isn't it obvious? E.g., if y is positive and x is negative, then it's in the quadrant defined by y > 0 and x < 0. |
Ah, I see what it means. It still feels weird, though, because that deviates from what "arc tangent" usually means in terms of a well-defined function. I wonder if it isn't better to simply transform the values using |
Description:
Math.atan2(1, -1)
, according to the spec, should be equivalent toMath.atan(1 / -1)
, because it falls into step 12:"Inverse tangent" is commonly defined to have range$\displaystyle \left[-\frac{\pi}{2},\frac{\pi}{2}\right]$ , which is also consistent with the behavior of
Math.atan()
(which is specified with the exact same wording). However, forx < 0
,Math.atan2()
does not use this range, and thus should be specified separately.eshost Output:
The text was updated successfully, but these errors were encountered: