Bug 126734 - Function atan2 has its arguments reversed.
Summary: Function atan2 has its arguments reversed.
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.5.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-06 18:42 UTC by photius829
Modified: 2019-08-07 22:14 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description photius829 2019-08-06 18:42:20 UTC
Description:
atan2(y,x) should return the same as atan(y/x) for x > 0.
Instead, it returns atan(x/y).
See https://en.wikipedia.org/wiki/Atan2 under "Definition and computation."

Steps to Reproduce:
1. Enter =atan2(1,2) in a cell.
2. Enter =atan(0.5) in another cell.
3. Enter =atan(2) in another cell.


Actual Results:
atan2(1,2) returns 1.10714871779409.
atan(0.5) returns 0.463647609000806.
atan(2) returns 1.10714871779409.




Expected Results:
atan2(1,2) returns 0.463647609000806.
atan(0.5) returns 0.463647609000806.
atan(2) returns 1.10714871779409.



Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no
Comment 1 photius829 2019-08-06 19:58:17 UTC
Microsoft Excel does the same as Calc for atan2. 

The definition seems to be atan2(x,y) instead of atan2(y,x).

Therefore this is not a bug.
Comment 2 Julien Nabet 2019-08-07 08:07:13 UTC
yes arguments of arctan2 function are x coordinate first, then y coordinate in Calc and Excel.
Comment 3 Regina Henschel 2019-08-07 22:14:59 UTC
Because of this confusion, the help has the info:

tip

Programming languages have usually the opposite order of arguments for their atan2() function.