Closed
Bug 1319996
Opened 9 years ago
Closed 9 years ago
Math.atan2() taking sign from x, should it be from x*y?
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: jmichae3, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161104212021
Steps to reproduce:
Math.atan2(2,3)
0.5880026035475675
Math.atan2(-2,3)
-0.5880026035475675
Math.atan2(-2,-3)
-2.5535900500422257
Math.atan2(2,-3)
2.5535900500422257
Math.atan2(2,3)
0.5880026035475675
Expected results:
if I remember right, Math.atan2 was supposed to render the original angle (range?) and wasn't supposed to be negative, but I could be wrong. someone please check spec. I hope spec has not changed for the wrong recently. this change seems to be in 50.0 and in opera.
Comment 1•9 years ago
|
||
https://tc39.github.io/ecma262/#sec-math.atan2
the 1st parameter of atan2 is "y", not "x".
and if "y" is negative, the angle becomes negative.
the angle is returned in (-Math.PI, Math.PI] range.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Comment 2•9 years ago
|
||
(In reply to Jim Michaels from comment #0)
> if I remember right, Math.atan2 was supposed to render the original angle
> (range?) and wasn't supposed to be negative, but I could be wrong. someone
> please check spec. I hope spec has not changed for the wrong recently. this
> change seems to be in 50.0 and in opera.
From the spec: "The result is expressed in radians and ranges from -π to +π.". This information is also on the Math.atan2 page on MDN [1].
Thank you for filing bugs, but next time please try to do some research first and test in multiple browsers. You have filed a number of bugs on JS features that work exactly the same in all browsers, in such cases it's very unlikely that all of them are buggy.
[0] https://tc39.github.io/ecma262/#sec-math.atan2
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/atan2
You need to log in
before you can comment on or make changes to this bug.
Description
•