Skip to content

Fix issue where generic compare on float values would be different … #6042

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
merged 6 commits into from
Mar 6, 2023

Conversation

cristianoc
Copy link
Collaborator

…from the compare for type float

Fixes #6040

@glennsl
Copy link
Contributor

glennsl commented Mar 6, 2023

Unfortunately still fails on a few cases:

  eq __LOC__ (generic_lessthan Js.Float._NaN 4.2) false;
  eq __LOC__ (generic_greaterthan 4.2 Js.Float._NaN) false;
  eq __LOC__ (generic_lessequal Js.Float._NaN Js.Float._NaN) false;
  eq __LOC__ (generic_lessequal Js.Float._NaN 4.2) false;
  eq __LOC__ (generic_greaterequal Js.Float._NaN Js.Float._NaN) false;
  eq __LOC__ (generic_greaterequal 4.2 Js.Float._NaN) false;

These are all in #6044

@glennsl
Copy link
Contributor

glennsl commented Mar 6, 2023

This will also affect min and max, which also uses compare, although the docs do state that "The result is unspecified if one of the arguments contains the float value nan." So perhaps this doesn't matter too much.

@cristianoc
Copy link
Collaborator Author

@glennsl should be OK now.

@glennsl
Copy link
Contributor

glennsl commented Mar 6, 2023

Perfect. Thanks! 🙂

@cristianoc cristianoc merged commit 232e165 into master Mar 6, 2023
@cristianoc cristianoc deleted the float_compare branch March 6, 2023 15:42
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.

Issues with compare primitives
2 participants