Skip to content

Commit 191e81f

Browse files
committed
ensure unary minus propagates NaN payloads exactly
1 parent 60392e0 commit 191e81f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/pass/float_nan.rs

+8
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,14 @@ fn test_f32() {
241241
]),
242242
|| F32::from(just1 % all1_snan),
243243
);
244+
245+
// Unary `-` must preserve payloads exactly.
246+
check_all_outcomes(HashSet::from_iter([F32::nan(Neg, Quiet, all1_payload)]), || {
247+
F32::from(-all1)
248+
});
249+
check_all_outcomes(HashSet::from_iter([F32::nan(Neg, Signaling, all1_payload)]), || {
250+
F32::from(-all1_snan)
251+
});
244252
}
245253

246254
fn test_f64() {

0 commit comments

Comments
 (0)