8000 BUG: np.tan(np.inf) test failure in Apple silicon by Developer-Ecosystem-Engineering · Pull Request #19974 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: np.tan(np.inf) test failure in Apple silicon #19974

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

Merged

Conversation

Developer-Ecosystem-Engineering
Copy link
Contributor

Numpy has a test failure where np.tan(np.inf) is not raising "invalid". The bug is due to an underlying bug in Apple's Libm. The bug is only present on arm64 and does not affect x86_64.

The changes here apply to sin, cos, and tan. If the input is a non-finite value, then return (x - x), which will raise "invalid" for x=INFINITY as well as return NAN for both INFINITY and NAN as input.

Testing:
On top of changes for #19926

Before change:

FAILED numpy/core/tests/test_umath.py::TestSpecialFloats::test_tan - AssertionError: FloatingPointError not raised by tan
1 failed, 15589 passed, 302 skipped, 1268 deselected, 31 xfailed, 3 xpassed in 70.99s (0:01:10)

After change:

15590 passed, 302 skipped, 1268 deselected, 31 xfailed, 3 xpassed in 71.38s (0:01:11)

< 8000 /div>
Numpy has a test failure where `np.tan(np.inf)` is not raising "invalid". The bug is due to an underlying bug in Apple's Libm.  The bug is only present on arm64 and does not affect x86_64.

The changes here apply to sin, cos, and tan. If the input is a non-finite value, then return `(x - x)`, which will raise "invalid" for `x=INFINITY` as well as return `NAN` for both `INFINITY` and `NAN` as input.

Testing:
(Note, the testing below is on top of another branch that fixes divide-by-zero failures in reciprocal)

Before change:
```
FAILED numpy/core/tests/test_umath.py::TestSpecialFloats::test_tan - AssertionError: FloatingPointError not raised by tan
1 failed, 15589 passed, 302 skipped, 1268 deselected, 31 xfailed, 3 xpassed in 70.99s (0:01:10)
```

After change:
```
15590 passed, 302 skipped, 1268 deselected, 31 xfailed, 3 xpassed in 71.38s (0:01:11)
```
@charris
Copy link
Member
charris commented Sep 27, 2021

Looks like you should also update the blocklist in numpy/core/src/common/npy_config.h

@Developer-Ecosystem-Engineering
Copy link
Contributor Author

Looks like you should also update the blocklist in numpy/core/src/common/npy_config.h

Thanks, taking a look.

@Developer-Ecosystem-Engineering Developer-Ecosystem-Engineering changed the title BUG: np.tan(np.inf) test failure BUG: np.tan(np.inf) test failure in Apple silicon Sep 27, 2021
@Developer-Ecosystem-Engineering
Copy link
Contributor Author
Developer-Ecosystem-Engineering commented Sep 27, 2021

Looks like you should also update the blocklist in numpy/core/src/common/npy_config.h

There are no alternative implementations available so the #undef approach doesn't look like it would work here

@charris charris merged commit aa61d14 into numpy:main Sep 28, 2021
@charris
Copy link
Member
charris commented Sep 28, 2021

Thanks @Developer-Ecosystem-Engineering .

@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Sep 28, 2021
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Sep 28, 2021
@mattip mattip mentioned this pull request Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0