-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Description
Tracking issue for the conversion float_bits_conv
feature, added by PR #39271.
The main topic during the PR's thread has been about how to handle signaling NaNs, and the final decision was to silently mask them, especially as LLVM behaviour regarding them is not well specified.
Another issue raised by @dwrensha was that sNaNs are not encoded consistently. IEEE 754-2008 (section 8.2.1 in the latest draft) specifies quiet NaNs to have their first bit of the trailing significand field set to 1, for signaling NaNs it should be set to 0. Some MIPS based platforms have it reversed. Should they be cfg'd out?
Metadata
Metadata
Assignees
Labels
B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.In the final comment period and will be merged soon unless new substantive objections are raised.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
est31 commentedon Apr 19, 2017
Hmm, seems this feature has broken the ieee754 crate:
Apparently you can't shadow functions with a trait: https://is.gd/oKiVZH (the first assert works, but the second fails)
est31 commentedon Apr 19, 2017
Is the issue above something we have to fix, or rather something the
ieee754
crate has to?hanna-kruppe commentedon Apr 30, 2017
@est31 RFC 1105 laid out that adding inherent methods is a minor change so it's up to the team(s) to decide whether we're okay with the practical impact of the change.
25 remaining items
sfackler commentedon Nov 13, 2017
Ah sure that makes sense.
est31 commentedon Nov 13, 2017
@gankro
very interesting! We need more people like you :).
I am personally okay with anything (the documentation was made vague purposefully!), but before we commit to anything that we can't reverse (e.g. making docs super clear that it is only a transmute), I'd love to get @gankro 's LLVM patch merged upstream so that it has been reviewed by LLVM reviewers and deemed okay.
sunfishcode commentedon Nov 13, 2017
Unfortunately, it is still necessary from LLVM's perspective; see https://github.com/llvm-mirror/llvm/blob/master/lib/Analysis/InstructionSimplify.cpp#L4142 for example. I support changing LLVM's behavior here, but this isn't just a case of fixing mistaken documentation; it's changing the policy, so we need to be careful.
Gankra commentedon Nov 13, 2017
Interesting. That transformation is justified by sNaN being bad, but in fact doesn't look for sNaN. Rather it looks for undef, and up to this point we've fairly conservatively considered doing ~anything with undef to be UB for Rust (because undef is poorly defined and we don't want to couple with LLVM semantics anyway).
As such, the existence of that transformation shouldn't actually be a barrier to us making this change? (we should still fix llvm as well)
jrmuizel commentedon Nov 13, 2017
FWIW, that change originally came from here: llvm-mirror/llvm@50b2ca4
sunfishcode commentedon Nov 15, 2017
@gankro That's a good point. Allowing Rust to produce sNaNs in more places doesn't break those kinds of optimizations. And I'm not aware of any optimizations that explicitly check for sNaNs, and I've checked all the usual suspects. So this change seems ok.
Auto merge of #46012 - Gankro:float-conv-transmute, r=sfackler
Auto merge of #46012 - Gankro:float-conv-transmute, r=sfackler
est31 commentedon Nov 24, 2017
cc #46246
Auto merge of #48552 - kennytm:lower-unstable-priority, r=nikomatsakis