digitalmars.D.bugs - [Issue 503] New: Names of arguments to atan2 are backwards
- d-bugmail puremagic.com (42/42) Nov 13 2006 http://d.puremagic.com/issues/show_bug.cgi?id=503
- d-bugmail puremagic.com (9/9) Dec 02 2006 http://d.puremagic.com/issues/show_bug.cgi?id=503
http://d.puremagic.com/issues/show_bug.cgi?id=503 Summary: Names of arguments to atan2 are backwards Product: D Version: 0.173 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: bugzilla digitalmars.com ReportedBy: wbaxter gmail.com As seen in the ddoc here: http://www.digitalmars.com/d/phobos/std_math.html and in the original source code in src/phobos/std.math.d atan2 is documented as taking (x,y) arguments, but it should be (y,x). If you look at the std.c.math.atan2l routine that atan2 calls, you'll see that it indeed is documented as taking y,x parameters, as is standard practice for atan2 calls. atan2(y,x) ~ atan(y/x). The labels on the table are also wrong. Here's a corrected version of the ddoc and function: /*************** * Calculates the arc tangent of y / x, * returning a value ranging from -π/2 to π/2. * * $(TABLE_SV * <tr> <th> y <th> x <th> atan(y, x) * <tr> <td> $(NAN) <td> anything <td> $(NAN) * <tr> <td> anything <td> $(NAN) <td> $(NAN) * <tr> <td> ±0.0 <td> > 0.0 <td> ±0.0 * <tr> <td> ±0.0 <td> ±0.0 <td> ±0.0 * <tr> <td> ±0.0 <td> < 0.0 <td> ±π * <tr> <td> ±0.0 <td> -0.0 <td> ±π * <tr> <td> > 0.0 <td> ±0.0 <td> π/2 * <tr> <td> < 0.0 <td> ±0.0 <td> π/2 * <tr> <td> > 0.0 <td> ∞ <td> ±0.0 * <tr> <td> ±∞ <td> anything <td> ±π/2 * <tr> <td> > 0.0 <td> -∞ <td> ±π * <tr> <td> ±∞ <td> ∞ <td> ±π/4 * <tr> <td> ±∞ <td> -∞ <td> ±3π/4 * ) */ real atan2(real y, real x) { return std.c.math.atan2l(y,x); } --
Nov 13 2006
http://d.puremagic.com/issues/show_bug.cgi?id=503 wbaxter gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Looks to be fixed. --
Dec 02 2006