You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
IEEE754 non-conformance: is_sign_negative does not apply on NANs #42425
What would be the expected result according to the standard? I would expect something that isn't a number to be neither negative nor positive, so I think the current results are correct?
My reading of the spec suggests the answer should be equivalent to is_sign_negative = signbit(x) != 0, where signbit is non-zero if the binary representation has sign bit set.
E.g. Section 6.2.1:
When encoded, all NaNs have a sign bit and a pattern of bits necessary to identify the encoding as a NaN and which determines its kind (sNaN vs. qNaN).
alludes to NaNs having a sign bit. The description of isSignMinus seems to quite clearly signal towards the fact that for NaNs the implementation ought to be inspecting this sign bit.
You can set the sign of NaN in rust with -::std::f64::NAN as well.
Activity
Thiez commentedon Jun 4, 2017
This program:
prints the following output when compiled with current master and nightly:
What would be the expected result according to the standard? I would expect something that isn't a number to be neither negative nor positive, so I think the current results are correct?
nagisa commentedon Jun 4, 2017
My reading of the spec suggests the answer should be equivalent to
is_sign_negative = signbit(x) != 0, wheresignbitis non-zero if the binary representation has sign bit set.E.g. Section 6.2.1:
alludes to
NaNs having a sign bit. The description ofisSignMinusseems to quite clearly signal towards the fact that forNaNs the implementation ought to be inspecting this sign bit.You can set the sign of
NaNin rust with-::std::f64::NANas well.Auto merge of #42431 - nagisa:core-float-2, r=alexcrichton
hanna-kruppe commentedon Nov 20, 2017
Isn't this fixed since #42431 was merged?
Merge #41