Fix atan2(a, a)#1808
Draft
isuruf wants to merge 1 commit into
Draft
Conversation
rikardn
reviewed
Jun 22, 2021
| r2 = div(mul(pi, i3), integer(-8)); | ||
| r2 = div(mul(pi, i5), integer(8)); | ||
| REQUIRE(eq(*r1, *r2)); | ||
|
|
Contributor
There was a problem hiding this comment.
We should have a test for atan2(x, x)
Contributor
There was a problem hiding this comment.
And also atan2(x, 0) etc to cover symbolic cases where the numerator or denominator could potentially be 0 or complex.
| return add(div(pi, index), mul(div(pi, i2), sub(sign(den), one))); | ||
| } else { | ||
| return div(pi, index); | ||
| return sub(div(pi, index), mul(div(pi, i2), sub(sign(den), one))); |
Contributor
There was a problem hiding this comment.
Are complex values of num and den handled by this case?
| else | ||
| return div(pi, i2); | ||
| } | ||
| return mul(div(pi, i2), sign(num)); |
Contributor
There was a problem hiding this comment.
I don't think this is correct. If we do atan2(x, 0) this will become pi/2 * sign(x), but for x = 0 this is should be NaN. Sympy keeps this case unevaluated as atan2(x, 0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.