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
But it appears f16 NaNs do not have this behavior. For example, the second assertion fails.
externcrate half;use half::*;fnmain(){let x = f16::from_bits(64513);let y = x.to_f32();assert!(x.is_sign_negative());println!("{}", y);assert!(y.is_sign_negative());}
I couldn't find any useful information about whether the standard specifies this. So I'm not sure if f16 should be consistent with f32 with respect to this behavior.
The text was updated successfully, but these errors were encountered:
shaobo-he
changed the title
Preserve signedness of NaNs when converted to f32?
Preserve the sign of NaNs when converted to f32?
May 8, 2019
Hello,
I noticed that the sign of
f32
NaNs are preserved when they are converted tof64
as indicated by this experiment: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=b23459b96256c673aa6d84ed79a10f50.But it appears
f16
NaNs do not have this behavior. For example, the second assertion fails.I couldn't find any useful information about whether the standard specifies this. So I'm not sure if
f16
should be consistent withf32
with respect to this behavior.The text was updated successfully, but these errors were encountered: