Skip to content

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

Merged
cristianoc merged 6 commits intomasterfrom
float_compare
Mar 6, 2023
Merged

Fix issue where generic compare on float values would be different …#6042
cristianoc merged 6 commits intomasterfrom
float_compare

Conversation

@cristianoc
Copy link
Copy Markdown
Collaborator

…from the compare for type float

Fixes #6040

@glennsl
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator Author

@glennsl should be OK now.

@glennsl
Copy link
Copy Markdown
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