Skip to content

Allow matching NaNs in allclose - #2974

Open
Boulea7 wants to merge 1 commit into
xtensor-stack:masterfrom
Boulea7:fix/allclose-equal-nan
Open

Boulea7 wants to merge 1 commit into
xtensor-stack:masterfrom
Boulea7:fix/allclose-equal-nan

Conversation

@Boulea7

@Boulea7 Boulea7 commented Dec 2, 2026

Copy link
Copy Markdown

Checklist

  • The title and commit message are descriptive.
  • The fix is in a single commit.
  • Regression tests cover the new argument.
  • The overload documents the argument.

Description

Fixes #1995.

xt::allclose(a, b, rtol, atol, true) uses the existing isclose rule for matching NaN positions. The default comparison treats matching NaNs as unequal. The regression also checks that C++ can still infer the type of the existing four-argument function address.

The standalone C++20 fixture passed eight checks, including one-sided NaNs and finite tolerances. All 72 cases in test/test_xmath.cpp passed.

This branch has not been deployed

No deployments
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.

xt::allclose does not support equalNan

1 participant