Skip to content

Fix NaN handling in is_sign_negative/positive - #42431

Merged
bors merged 1 commit into
rust-lang:masterfrom
nagisa:core-float-2
Jun 28, 2017
Merged

Fix NaN handling in is_sign_negative/positive#42431
bors merged 1 commit into
rust-lang:masterfrom
nagisa:core-float-2

Conversation

@nagisa

@nagisanagisa commented Jun 4, 2017

Copy link
Copy Markdown
Member

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.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

Comment threadsrc/libcore/num/f32.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is has?

Copy link
Copy Markdown
Contributor

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, NaNs with negative sign, and negative infinity". I would not expect those cases to have a positive sign.

@nagisa
nagisaforce-pushed the core-float-2 branch 2 times, most recently from 8c1ee68 to 0853ec5CompareJune 4, 2017 23:29
@natboehm

Copy link
Copy Markdown
Contributor
[01:11:11] failures:
[01:11:11] f32::tests::test_is_sign_positive
[01:11:11] f32::tests::test_nan
[01:11:11] f64::tests::test_is_sign_positive
[01:11:11] f64::tests::test_nan

It looks like some tests are failing.

@carols10centscarols10cents added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 5, 2017
@nagisa

nagisa commented Jun 5, 2017

Copy link
Copy Markdown
MemberAuthor

This is not supposed to be in a landable state until we reach some concensus anyway.

@arielb1arielb1 added T-libs-api [DEPRECATED; DO NOT USE] S-waiting-on-team and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 6, 2017
@brsonbrson added the relnotes Marks issues that should be documented in the release notes of the next release. label Jun 6, 2017
@arielb1

Copy link
Copy Markdown
Contributor

What's the status of this @nagisa? Just checking in to make sure it isn't getting lost.

@alexcrichton

Copy link
Copy Markdown
Member

Discussed during libs triage the conclusion was that this seems good to land! @nagisa want to fix up the tests and I'll r+?

@alexcrichtonalexcrichton added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-team labels Jun 22, 2017
@alexcrichton

Copy link
Copy Markdown
Member

Looks like there's some Travis errors?

[01:11:14] failures:
[01:11:14] [01:11:14] ---- f32.rs - f32::f32::is_sign_negative (line 388) stdout ----
[01:11:14] thread 'rustc' panicked at 'test executable failed:
[01:11:14] [01:11:14] thread 'main' panicked at 'assertion failed: !nan.is_sign_positive() && !nan.is_sign_negative()', <anon>:13
[01:11:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:11:14] [01:11:14] ', /checkout/src/librustdoc/test.rs:318
[01:11:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:11:14] [01:11:14] ---- f32.rs - f32::f32::is_sign_positive (line 369) stdout ----
[01:11:14] thread 'rustc' panicked at 'test executable failed:
[01:11:14] [01:11:14] thread 'main' panicked at 'assertion failed: !nan.is_sign_positive() && !nan.is_sign_negative()', <anon>:13
[01:11:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:11:14] [01:11:14] ', /checkout/src/librustdoc/test.rs:318
[01:11:14] [01:11:14] ---- f64.rs - f64::f64::is_sign_negative (line 332) stdout ----
[01:11:14] thread 'rustc' panicked at 'test executable failed:
[01:11:14] [01:11:14] thread 'main' panicked at 'assertion failed: !nan.is_sign_positive() && !nan.is_sign_negative()', <anon>:14
[01:11:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:11:14] [01:11:14] ', /checkout/src/librustdoc/test.rs:318
[01:11:14] [01:11:14] ---- f64.rs - f64::f64::is_sign_positive (line 307) stdout ----
[01:11:14] thread 'rustc' panicked at 'test executable failed:
[01:11:14] [01:11:14] thread 'main' panicked at 'assertion failed: !nan.is_sign_positive() && !nan.is_sign_negative()', <anon>:14
[01:11:14] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:11:14] [01:11:14] ', /checkout/src/librustdoc/test.rs:318
[01:11:14] [01:11:14] [01:11:14] failures:
[01:11:14] f32.rs - f32::f32::is_sign_negative (line 388)
[01:11:14] f32.rs - f32::f32::is_sign_positive (line 369)
[01:11:14] f64.rs - f64::f64::is_sign_negative (line 332)
[01:11:14] f64.rs - f64::f64::is_sign_positive (line 307)
[01:11:14] [01:11:14] test result: FAILED. 820 passed; 4 failed; 22 ignored; 0 measured; 0 filtered out

@arielb1

Copy link
Copy Markdown
Contributor

@nagisa is this ready for review?

@nagisanagisa added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 27, 2017
@nagisa

Copy link
Copy Markdown
MemberAuthor

@alexcrichton tests pass.

@alexcrichton

Copy link
Copy Markdown
Member

@bors: r+

@bors

bors commented Jun 27, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 3b9fe77 has been approved by alexcrichton

@alexcrichton

Copy link
Copy Markdown
Member

@bors: r+

@bors

bors commented Jun 27, 2017

Copy link
Copy Markdown
Collaborator

💡 This pull request was already approved, no need to approve it again.

@bors

bors commented Jun 27, 2017

Copy link
Copy Markdown
Collaborator

📌 Commit 3b9fe77 has been approved by alexcrichton

@bors

bors commented Jun 28, 2017

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 3b9fe77 with merge 88c3242...

bors added a commit that referenced this pull request Jun 28, 2017
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.
@bors

bors commented Jun 28, 2017

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 88c3242 to master...

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

relnotesMarks issues that should be documented in the release notes of the next release.S-waiting-on-reviewStatus: Awaiting review from the assignee but also interested parties.T-libs-api[DEPRECATED; DO NOT USE]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants

@nagisa@rust-highfive@natboehm@arielb1@alexcrichton@bors@Thiez@retep998@brson@carols10cents