After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 640344 - Incorrect documentation of atan2(y, x)
Incorrect documentation of atan2(y, x)
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Documentation
1.10.x
Other All
: Normal normal
: ---
Assigned To: Andreas J. Guelzow
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2011-01-23 21:15 UTC by yuzisee
Modified: 2011-01-23 23:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description yuzisee 2011-01-23 21:15:17 UTC
http://projects.gnome.org/gnumeric/doc/gnumeric-ATAN2.shtml
and
the documentation within (Insert > Function) both descrive atan2 as:

b1: angle in radians
b2: angle in radians

"ATAN2 calculates the arc tangent of the ratio b1/b2..."

or

Arguments:
y: y-coordinate
x: x-coordinate


However, the inputs appear to be switched!

compare:
=atan2(0.5,0.7)
=atan(0.5/0.7)

They should be the same, but instead...
=atan2(0.7,0.5)
is the one that matches.
Comment 2 Andreas J. Guelzow 2011-01-23 21:48:06 UTC
The description:

---------------------------------------
b1: angle in radians
b2: angle in radians

"ATAN2 calculates the arc tangent of the ratio b1/b2..."
---------------------------------------

on the web site is unfortunately outdated. (This is a problem with the website. The documentation in the source that is used to create the html documentation is correct. See for example: http://www.math.concordia.ab.ca/~aguelzow/gnumeric/gnumeric-ATAN2.shtml

So the intended description is as in function help browser:

----------------------------------
ATAN2: the arc tangent of the ratio of y and x

Arguments:
y: y-coordinate
x: x-coordinate

ATAN2 calculates the direction from the origin to (x,y) as an angle in radians.
---------------------------------

And you are absolutely correct that this does not reflect what ATAN2 really calculates.

Since this function is intended to be XL compatible we need to check what XL is really calculating to determine whether our function or our documentation is incorrect. On teh web the description of ATAN2 for Excel 2003 and newer is:

-------------------------------------    
ATan2 function returns the arctangent (in radians) of (x,y) coordinates.
ATan2( x-coordinate, y-coordinate )

x-coordinate is the x-coordinate of a point.
y-coordinate is the y-coordinate of a point.
------------------------------------- 

Similarly the ODF description is:
-------------------------------------
   Summary: Returns the principal value of the arc tangent given a coordinate of two numbers.
The angle is returned in radians.
Syntax: ATAN2( Number x ; Number y )
Returns: Number
Constraints: x<>0 or y<>0
Semantics: Computes the arc tangent of two numbers (the x and y coordinates of a point), in radians. This is similar to ATAN(y/x), but the signs of the two numbers are taken into account so that the result covers the full range from -PI() to +PI(). ATAN2(0;0) is implementation-defined, evaluators may return 0 or an Error.
Returns a principal value -PI < result ≤ PI.
--------------------------------------

Reassigning to "Documentation" since this is most likely a documentation mistake.
Comment 3 Andreas J. Guelzow 2011-01-23 23:58:33 UTC
This indeed was a documentation issue. The documentation has been corrected.

This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.