Skip to content

Commit

Permalink
remove NaN conversion sign tests due to hardware bugs. Closes #103
Browse files Browse the repository at this point in the history
  • Loading branch information
starkat99 committed Feb 25, 2024
1 parent a513d3b commit dd181b7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
28 changes: 16 additions & 12 deletions src/bfloat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,12 +1498,14 @@ mod test {
assert!(neg_nan64.is_nan() && neg_nan64.is_sign_negative());
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());
assert!(nan32_from_64.is_nan() && nan32_from_64.is_sign_positive());
assert!(neg_nan32_from_64.is_nan() && neg_nan32_from_64.is_sign_negative());
assert!(nan16_from_64.is_nan() && nan16_from_64.is_sign_positive());
assert!(neg_nan16_from_64.is_nan() && neg_nan16_from_64.is_sign_negative());
assert!(nan16_from_32.is_nan() && nan16_from_32.is_sign_positive());
assert!(neg_nan16_from_32.is_nan() && neg_nan16_from_32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
assert!(neg_nan32_from_64.is_nan());
assert!(nan32_from_64.is_nan());
assert!(nan16_from_64.is_nan());
assert!(neg_nan16_from_64.is_nan());
assert!(nan16_from_32.is_nan());
assert!(neg_nan16_from_32.is_nan());
}

#[test]
Expand All @@ -1523,12 +1525,14 @@ mod test {
assert!(neg_nan16.is_nan() && neg_nan16.is_sign_negative());
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());
assert!(nan32_from_16.is_nan() && nan32_from_16.is_sign_positive());
assert!(neg_nan32_from_16.is_nan() && neg_nan32_from_16.is_sign_negative());
assert!(nan64_from_16.is_nan() && nan64_from_16.is_sign_positive());
assert!(neg_nan64_from_16.is_nan() && neg_nan64_from_16.is_sign_negative());
assert!(nan64_from_32.is_nan() && nan64_from_32.is_sign_positive());
assert!(neg_nan64_from_32.is_nan() && neg_nan64_from_32.is_sign_negative());

// // f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
assert!(nan32_from_16.is_nan());
assert!(neg_nan32_from_16.is_nan());
assert!(nan64_from_16.is_nan());
assert!(neg_nan64_from_16.is_nan());
assert!(nan64_from_32.is_nan());
assert!(neg_nan64_from_32.is_nan());
}

#[test]
Expand Down
28 changes: 16 additions & 12 deletions src/binary16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1566,12 +1566,14 @@ mod test {
assert!(neg_nan64.is_nan() && neg_nan64.is_sign_negative());
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());
assert!(nan32_from_64.is_nan() && nan32_from_64.is_sign_positive());
assert!(neg_nan32_from_64.is_nan() && neg_nan32_from_64.is_sign_negative());
assert!(nan16_from_64.is_nan() && nan16_from_64.is_sign_positive());
assert!(neg_nan16_from_64.is_nan() && neg_nan16_from_64.is_sign_negative());
assert!(nan16_from_32.is_nan() && nan16_from_32.is_sign_positive());
assert!(neg_nan16_from_32.is_nan() && neg_nan16_from_32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
assert!(nan32_from_64.is_nan());
assert!(neg_nan32_from_64.is_nan());
assert!(nan16_from_64.is_nan());
assert!(neg_nan16_from_64.is_nan());
assert!(nan16_from_32.is_nan());
assert!(neg_nan16_from_32.is_nan());
}

#[test]
Expand All @@ -1591,12 +1593,14 @@ mod test {
assert!(neg_nan16.is_nan() && neg_nan16.is_sign_negative());
assert!(nan32.is_nan() && nan32.is_sign_positive());
assert!(neg_nan32.is_nan() && neg_nan32.is_sign_negative());
assert!(nan32_from_16.is_nan() && nan32_from_16.is_sign_positive());
assert!(neg_nan32_from_16.is_nan() && neg_nan32_from_16.is_sign_negative());
assert!(nan64_from_16.is_nan() && nan64_from_16.is_sign_positive());
assert!(neg_nan64_from_16.is_nan() && neg_nan64_from_16.is_sign_negative());
assert!(nan64_from_32.is_nan() && nan64_from_32.is_sign_positive());
assert!(neg_nan64_from_32.is_nan() && neg_nan64_from_32.is_sign_negative());

// f32/f64 NaN conversion sign is non-deterministic: https://github.com/starkat99/half-rs/issues/103
assert!(nan32_from_16.is_nan());
assert!(neg_nan32_from_16.is_nan());
assert!(nan64_from_16.is_nan());
assert!(neg_nan64_from_16.is_nan());
assert!(nan64_from_32.is_nan());
assert!(neg_nan64_from_32.is_nan());
}

#[test]
Expand Down

0 comments on commit dd181b7

Please sign in to comment.