digitalmars.D.bugs - [Issue 1877] New: Errors in the documentation of std.math.atan2
- d-bugmail puremagic.com (22/22) Feb 27 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1877
- d-bugmail puremagic.com (6/16) Feb 29 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1877
- Bill Baxter (9/30) Feb 29 2008 Who says the atan2(inf,inf) is pi/4? Is that an IEEE thing?
- Don Clugston (5/41) Feb 29 2008 Yup.
- d-bugmail puremagic.com (9/9) Feb 29 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1877
- d-bugmail puremagic.com (9/9) Mar 06 2008 http://d.puremagic.com/issues/show_bug.cgi?id=1877
http://d.puremagic.com/issues/show_bug.cgi?id=1877 Summary: Errors in the documentation of std.math.atan2 Product: D Version: 2.011 Platform: PC URL: http://www.digitalmars.com/d/2.0/phobos/std_math.html OS/Version: All Status: NEW Severity: minor Priority: P2 Component: www.digitalmars.com AssignedTo: bugzilla digitalmars.com ReportedBy: lio lunesu.com First of all, the doc states "Calculates the arc tangent of y / x, returning a value ranging from -π/2 to π/2." which should be "..from -π to π.", as is shown in the table. Then, there are a couple of inconsistencies in the "Special Values" table: "±0.0 ±0.0 ±0.0" should be "±0.0 +0.0 ±0.0", "<0.0 ±0.0 π/2" should be "<0.0 ±0.0 -π/2", ">0.0 ∞ ±0.0" should be "anything ∞ ±0.0", ">0.0 -∞ ±π" should be "anything -∞ ±π". --
Feb 27 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1877First of all, the doc states "Calculates the arc tangent of y / x, returning a value ranging from -π/2 to π/2." which should be "..from -π to π.", as is shown in the table. Then, there are a couple of inconsistencies in the "Special Values" table: "±0.0 ±0.0 ±0.0" should be "±0.0 +0.0 ±0.0", "<0.0 ±0.0 π/2" should be "<0.0 ±0.0 -π/2", ">0.0 ∞ ±0.0" should be "anything ∞ ±0.0", ">0.0 -∞ ±π" should be "anything -∞ ±π".You're correct for the first three, but not for the last two. atan2(NaN, inf) is NaN, not +-0. Also atan2(inf, inf) is pi/4. --
Feb 29 2008
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=1877Who says the atan2(inf,inf) is pi/4? Is that an IEEE thing? Seems odd since that's like saying atan(inf/inf), and inf/inf is NaN, isn't it? Put another way atan2(inf,inf) the limit of any atan2(k*x,x) as x gets big. Since k could be anything, it seems strange for the value to suddenly change to pi/4 when x becomes inf. --bbFirst of all, the doc states "Calculates the arc tangent of y / x, returning a value ranging from -π/2 to π/2." which should be "..from -π to π.", as is shown in the table. Then, there are a couple of inconsistencies in the "Special Values" table: "±0.0 ±0.0 ±0.0" should be "±0.0 +0.0 ±0.0", "<0.0 ±0.0 π/2" should be "<0.0 ±0.0 -π/2", ">0.0 ∞ ±0.0" should be "anything ∞ ±0.0", ">0.0 -∞ ±π" should be "anything -∞ ±π".You're correct for the first three, but not for the last two. atan2(NaN, inf) is NaN, not +-0. Also atan2(inf, inf) is pi/4.
Feb 29 2008
Bill Baxter wrote:d-bugmail puremagic.com wrote:Yup. For a sanity check, here's a link to the Java docs: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Math.html#atan2(double,%20double)http://d.puremagic.com/issues/show_bug.cgi?id=1877Who says the atan2(inf,inf) is pi/4? Is that an IEEE thing?First of all, the doc states "Calculates the arc tangent of y / x, returning a value ranging from -π/2 to π/2." which should be "..from -π to π.", as is shown in the table. Then, there are a couple of inconsistencies in the "Special Values" table: "±0.0 ±0.0 ±0.0" should be "±0.0 +0.0 ±0.0", "<0.0 ±0.0 π/2" should be "<0.0 ±0.0 -π/2", ">0.0 ∞ ±0.0" should be "anything ∞ ±0.0", ">0.0 -∞ ±π" should be "anything -∞ ±π".You're correct for the first three, but not for the last two. atan2(NaN, inf) is NaN, not +-0. Also atan2(inf, inf) is pi/4.Seems odd since that's like saying atan(inf/inf), and inf/inf is NaN, isn't it?Yes, it's one of the strange IEEE results. There's a couple that are controversial.Put another way atan2(inf,inf) the limit of any atan2(k*x,x) as x gets big. Since k could be anything, it seems strange for the value to suddenly change to pi/4 when x becomes inf. --bb
Feb 29 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1877 I was using "anything" more like "anything, except values explicitely mentioned elsewhere in this table", as seems to be the case in the row "±∞ anything ±π/2", already present in the table. Also "inf,inf" is explictely mentioned in the table, so was not meant by "anything". I agree that the word "anything" should be best avoided and replaced by "<>0" or something similarly D-like. --
Feb 29 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1877 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 1.028 and 2.012 --
Mar 06 2008