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
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
, wheresignbit
is non-zero if the binary representation has sign bit set.E.g. Section 6.2.1:
alludes to
NaN
s having a sign bit. The description ofisSignMinus
seems to quite clearly signal towards the fact that forNaN
s the implementation ought to be inspecting this sign bit.You can set the sign of
NaN
in rust with-::std::f64::NAN
as well.9 remaining items