Skip to content

Conversation

@retronym
Copy link
Member

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

@scala-jenkins scala-jenkins added this to the 2.11.6 milestone Jan 16, 2015
@Ichoran
Copy link
Contributor

Ichoran commented Jan 16, 2015

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.)

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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).

@retronym
Copy link
Member Author

PLS REBUILD ALL

@scala-jenkins
Copy link

(kitty-note-to-self: ignore 70583087)
🐱 Roger! Rebuilding pr-scala for 313c894. 🚨

@retronym retronym force-pushed the ticket/9087 branch 2 times, most recently from cefa0e1 to 177384f Compare January 20, 2015 04:17
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}`.
@retronym
Copy link
Member Author

@Ichoran I've pushed a change that updates an incorrect assertion in an existing test.

@Ichoran
Copy link
Contributor

Ichoran commented Jan 20, 2015

LGTM still (LEBTM, I guess--looks even better)!

gkossakowski added a commit that referenced this pull request Jan 20, 2015
SI-9087 Fix min/max of reversed Double/Float orderings
@gkossakowski gkossakowski merged commit 51e7703 into scala:2.11.x Jan 20, 2015
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.

4 participants