Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-scalar arguments to atan2 when dimensions match #31

Merged
merged 2 commits into from
May 18, 2018
Merged

Allow non-scalar arguments to atan2 when dimensions match #31

merged 2 commits into from
May 18, 2018

Conversation

imacg
Copy link
Contributor

@imacg imacg commented May 18, 2018

Fix atan2 to allow arguments with the same dimensions and remove duplicate code.

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thank you very much!!

I think we can remove the old lift2 function (it is not exported and not used anywhere) and rename your new implementation from lift2' to lift2.

@imacg
Copy link
Contributor Author

imacg commented May 18, 2018

Thanks. Sorry for missing the dead function.

@sharkdp
Copy link
Owner

sharkdp commented May 18, 2018

Thank you!

@sharkdp sharkdp merged commit 1cf287d into sharkdp:master May 18, 2018
@imacg imacg deleted the fix-atan2 branch May 18, 2018 16:36
@sharkdp
Copy link
Owner

sharkdp commented May 18, 2018

Oh - my bad: I should have checked it more thoroughly before merging.

Your changes are great for max2, min2, and modulo, but atan2 has to be handled differently, I think.

Conceptually, atan2(y, x) is like atan(y/x). So we want y and x to have compatible units, however: the result is dimensionless!

@sharkdp
Copy link
Owner

sharkdp commented May 18, 2018

Unfortunately, we didn't have any tests for atan2. We should add something like this (somewhere around here):

    test "atan2" do
      almostEqual' (scalar (Math.pi / 4.0)) ((100.0 .* centi meter) `atan2` (1.0 .* meter))

@imacg
Copy link
Contributor Author

imacg commented May 18, 2018

I've fixed the issue and added a few tests. Unfortunately since I deleted my branch before your comment this PR isn't tracking my changes; are you able to edit this PR or should I open a new one?

Thanks for your patients.

@sharkdp
Copy link
Owner

sharkdp commented May 18, 2018

Please open a new PR. Thank you very much!

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.

2 participants