Skip to content

Implement isfinite, isinf, isnan ufuncs #121

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

juntyr
Copy link
Contributor

@juntyr juntyr commented Jul 21, 2025

Based on and blocked on #118, only the last commit is new

Progress towards #111

@juntyr
Copy link
Contributor Author

juntyr commented Jul 21, 2025

I get some weird runtime warnings in the isfinite and isinf ufuncs:

tests/test_quaddtype.py: 10 warnings
  /workspaces/numpy-user-dtypes/quaddtype/tests/test_quaddtype.py:113: RuntimeWarning: invalid value encountered in isfinite
    quad_result = op_func(quad_val)

tests/test_quaddtype.py: 10 warnings
  /workspaces/numpy-user-dtypes/quaddtype/tests/test_quaddtype.py:113: RuntimeWarning: invalid value encountered in isinf
    quad_result = op_func(quad_val)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Any idea what I'm doing wrong?

@juntyr juntyr mentioned this pull request Jul 21, 2025
11 tasks
@seberg
Copy link
Member

seberg commented Jul 21, 2025

IEEE says comparisons with NaNs trigger FPEs (floating point error; FPEs are a flag set on the CPU when one occurs basically). That means normally also nan == inf.
C99 has special comparison functions for this purpose (not that all compilers used to get it right). Maybe sleef gets these warnings right, maybe not. But the best solution would be to avoid the function triggering it. Maybe sleef has a quiet comparison or just a way to test for this without a comparison.

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