-
Notifications
You must be signed in to change notification settings - Fork 3.1k
SI-9087 Fix min/max of reversed Double/Float orderings #4253
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
Conversation
|
LGTM - the behavior looks correct (inasmuch as any of the NaN behavior really feels "correct"), and I think any bincompat issues are ignorable since it's an anonymous class. (FWIW, if "reverse" gets used much, having it create it anew on each call on the implicit object is a bad idea, but that's not related to this fix.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it makes any practical difference, but why are the args not swapped here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to highlight that we swap the operation, not the args.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but then why are the args swapped here? Not that it really matters since practically nobody cares which NaN it is, but both min and max return the first argument's NaN even if the second argument is also NaN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just changed this one to min(x, y).
|
PLS REBUILD ALL |
|
(kitty-note-to-self: ignore 70583087) |
cefa0e1 to
177384f
Compare
As diagnosed by the reporter, we needed additional overrides
due to the way these orderings are implemented.
I've added tests to show other methods and other orderings
are working correctly.
After writing that, I found a scalacheck test related to
NaN handling that also covers `Ordering`. I had to correct
the assertion in the tests of `reverse.{min,max}`.
|
@Ichoran I've pushed a change that updates an incorrect assertion in an existing test. |
|
LGTM still (LEBTM, I guess--looks even better)! |
SI-9087 Fix min/max of reversed Double/Float orderings
As diagnosed by the reporter, we needed additional overrides
due to the way these orderings are implemented.
I've added tests to show other methods and other orderings
are working correctly.
Review by @Ichoran