-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix NaN handling in is_sign_negative/positive #42431
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
src/libcore/num/f32.rs
Outdated
@@ -205,18 +205,25 @@ impl Float for f32 { | |||
} | |||
} | |||
|
|||
/// Returns `true` if `self` is positive, including `+0.0` and | |||
/// `Float::infinity()`. | |||
/// Returns `true` if and only if `self` is has a positive sign, including `-0.0`, `NaN`s with |
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.
is has
?
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'm more surprised that it returns true
for "-0.0
, NaN
s with negative sign, and negative infinity". I would not expect those cases to have a positive sign.
8c1ee68
to
0853ec5
Compare
It looks like some tests are failing. |
This is not supposed to be in a landable state until we reach some concensus anyway. |
What's the status of this @nagisa? Just checking in to make sure it isn't getting lost. |
Discussed during libs triage the conclusion was that this seems good to land! @nagisa want to fix up the tests and I'll r+? |
Looks like there's some Travis errors?
|
@nagisa is this ready for review? |
@alexcrichton tests pass. |
@bors: r+ |
📌 Commit 3b9fe77 has been approved by |
@bors: r+ |
💡 This pull request was already approved, no need to approve it again.
|
📌 Commit 3b9fe77 has been approved by |
Fix NaN handling in is_sign_negative/positive This would be my proposed fix for the #42425 provided we decide it is indeed a problem. Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.
☀️ Test successful - status-appveyor, status-travis |
This would be my proposed fix for the #42425 provided we decide it is indeed a problem.
Note this would technically be a breaking change to a stable API. We might want to consider deprecating these methods and adding new ones.