Skip to content

fix(xlsx): correct ATAN2 argument order - #226

Open
LeoLin990405 wants to merge 1 commit into
iOfficeAI:mainfrom
LeoLin990405:fix-atan2-argument-order
Open

fix(xlsx): correct ATAN2 argument order#226
LeoLin990405 wants to merge 1 commit into
iOfficeAI:mainfrom
LeoLin990405:fix-atan2-argument-order

Conversation

@LeoLin990405

Copy link
Copy Markdown

Fixes #211.

Summary

  • Swap the coordinates passed from Excel ATAN2(x_num, y_num) into .NET Math.Atan2(y, x) order.
  • This makes =ATAN2(1,0) evaluate to 0 instead of pi/2.

Validation

  • git diff --check
  • Numerical sanity check:
    • old order: atan2(1, 0) -> 1.5707963267948966
    • fixed order: atan2(0, 1) -> 0

Not run: dotnet publish / CLI smoke, because this local machine does not have a .NET SDK installed.

Excel ATAN2 takes arguments as (x_num, y_num), while .NET Math.Atan2 expects (y, x). Swap the forwarded coordinates so evaluated formulas match Excel's function contract.

Refs iOfficeAI#211.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ATAN2 passes arguments in the wrong order to Math.Atan2

1 participant