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

Correct handling of NaN inputs to comparator #8

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

MichaelChirico
Copy link
Contributor

At HEAD, our tooling is throwing an error on this operator< because it is not a strict weak ordering:

https://www.boost.org/sgi/stl/StrictWeakOrdering.html

As summarized:

As doubles/floats can be NaN which means x < NaN and NaN < x are both false and that means x is equivalent to NaN thus for every finite x we have x == NaN but clearly x == NaN and y == NaN does not imply x == y.

@edzer edzer merged commit 0fe82fe into edzer:master Sep 6, 2023
@edzer
Copy link
Owner

edzer commented Sep 6, 2023

Thanks Michael!

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