diff options
| -rw-r--r-- | library/std/tests/floats/f128.rs | 2 | ||||
| -rw-r--r-- | library/std/tests/floats/f16.rs | 2 | ||||
| -rw-r--r-- | library/std/tests/floats/f32.rs | 2 | ||||
| -rw-r--r-- | library/std/tests/floats/f64.rs | 2 |
4 files changed, 8 insertions, 0 deletions
diff --git a/library/std/tests/floats/f128.rs b/library/std/tests/floats/f128.rs index df28e8129dd..677738bac8f 100644 --- a/library/std/tests/floats/f128.rs +++ b/library/std/tests/floats/f128.rs @@ -112,6 +112,8 @@ fn test_nan() { assert!(!nan.is_sign_negative()); assert!(!nan.is_normal()); assert_eq!(Fp::Nan, nan.classify()); + // Ensure the quiet bit is set. + assert!(nan.to_bits() & (1 << (f128::MANTISSA_DIGITS - 2)) != 0); } #[test] diff --git a/library/std/tests/floats/f16.rs b/library/std/tests/floats/f16.rs index 1a90f00aecc..0fc4df8115a 100644 --- a/library/std/tests/floats/f16.rs +++ b/library/std/tests/floats/f16.rs @@ -95,6 +95,8 @@ fn test_nan() { assert!(!nan.is_sign_negative()); assert!(!nan.is_normal()); assert_eq!(Fp::Nan, nan.classify()); + // Ensure the quiet bit is set. + assert!(nan.to_bits() & (1 << (f16::MANTISSA_DIGITS - 2)) != 0); } #[test] diff --git a/library/std/tests/floats/f32.rs b/library/std/tests/floats/f32.rs index d99b03cb255..9af23afc5bb 100644 --- a/library/std/tests/floats/f32.rs +++ b/library/std/tests/floats/f32.rs @@ -72,6 +72,8 @@ fn test_nan() { assert!(nan.is_sign_positive()); assert!(!nan.is_sign_negative()); assert_eq!(Fp::Nan, nan.classify()); + // Ensure the quiet bit is set. + assert!(nan.to_bits() & (1 << (f32::MANTISSA_DIGITS - 2)) != 0); } #[test] diff --git a/library/std/tests/floats/f64.rs b/library/std/tests/floats/f64.rs index 611670751bb..de9c27eb33d 100644 --- a/library/std/tests/floats/f64.rs +++ b/library/std/tests/floats/f64.rs @@ -60,6 +60,8 @@ fn test_nan() { assert!(nan.is_sign_positive()); assert!(!nan.is_sign_negative()); assert_eq!(Fp::Nan, nan.classify()); + // Ensure the quiet bit is set. + assert!(nan.to_bits() & (1 << (f64::MANTISSA_DIGITS - 2)) != 0); } #[test] |
