File tree 8 files changed +20
-0
lines changed
8 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,9 @@ impl f128 {
145
145
pub const RADIX : u32 = 2 ;
146
146
147
147
/// Number of significant digits in base 2.
148
+ ///
149
+ /// Note that the size of the mantissa in the bitwise representation is one
150
+ /// smaller than this since the leading 1 is not stored explicitly.
148
151
#[ unstable( feature = "f128" , issue = "116909" ) ]
149
152
pub const MANTISSA_DIGITS : u32 = 113 ;
150
153
Original file line number Diff line number Diff line change @@ -140,6 +140,9 @@ impl f16 {
140
140
pub const RADIX : u32 = 2 ;
141
141
142
142
/// Number of significant digits in base 2.
143
+ ///
144
+ /// Note that the size of the mantissa in the bitwise representation is one
145
+ /// smaller than this since the leading 1 is not stored explicitly.
143
146
#[ unstable( feature = "f16" , issue = "116909" ) ]
144
147
pub const MANTISSA_DIGITS : u32 = 11 ;
145
148
Original file line number Diff line number Diff line change @@ -390,6 +390,9 @@ impl f32 {
390
390
pub const RADIX : u32 = 2 ;
391
391
392
392
/// Number of significant digits in base 2.
393
+ ///
394
+ /// Note that the size of the mantissa in the bitwise representation is one
395
+ /// smaller than this since the leading 1 is not stored explicitly.
393
396
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
394
397
pub const MANTISSA_DIGITS : u32 = 24 ;
395
398
Original file line number Diff line number Diff line change @@ -390,6 +390,9 @@ impl f64 {
390
390
pub const RADIX : u32 = 2 ;
391
391
392
392
/// Number of significant digits in base 2.
393
+ ///
394
+ /// Note that the size of the mantissa in the bitwise representation is one
395
+ /// smaller than this since the leading 1 is not stored explicitly.
393
396
#[ stable( feature = "assoc_int_consts" , since = "1.43.0" ) ]
394
397
pub const MANTISSA_DIGITS : u32 = 53 ;
395
398
/// Approximate number of significant digits in base 10.
Original file line number Diff line number Diff line change @@ -112,6 +112,8 @@ fn test_nan() {
112
112
assert ! ( !nan. is_sign_negative( ) ) ;
113
113
assert ! ( !nan. is_normal( ) ) ;
114
114
assert_eq ! ( Fp :: Nan , nan. classify( ) ) ;
115
+ // Ensure the quiet bit is set.
116
+ assert ! ( nan. to_bits( ) & ( 1 << ( f128:: MANTISSA_DIGITS - 2 ) ) != 0 ) ;
115
117
}
116
118
117
119
#[ test]
Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ fn test_nan() {
95
95
assert ! ( !nan. is_sign_negative( ) ) ;
96
96
assert ! ( !nan. is_normal( ) ) ;
97
97
assert_eq ! ( Fp :: Nan , nan. classify( ) ) ;
98
+ // Ensure the quiet bit is set.
99
+ assert ! ( nan. to_bits( ) & ( 1 << ( f16:: MANTISSA_DIGITS - 2 ) ) != 0 ) ;
98
100
}
99
101
100
102
#[ test]
Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ fn test_nan() {
72
72
assert ! ( nan. is_sign_positive( ) ) ;
73
73
assert ! ( !nan. is_sign_negative( ) ) ;
74
74
assert_eq ! ( Fp :: Nan , nan. classify( ) ) ;
75
+ // Ensure the quiet bit is set.
76
+ assert ! ( nan. to_bits( ) & ( 1 << ( f32 :: MANTISSA_DIGITS - 2 ) ) != 0 ) ;
75
77
}
76
78
77
79
#[ test]
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ fn test_nan() {
60
60
assert ! ( nan. is_sign_positive( ) ) ;
61
61
assert ! ( !nan. is_sign_negative( ) ) ;
62
62
assert_eq ! ( Fp :: Nan , nan. classify( ) ) ;
63
+ // Ensure the quiet bit is set.
64
+ assert ! ( nan. to_bits( ) & ( 1 << ( f64 :: MANTISSA_DIGITS - 2 ) ) != 0 ) ;
63
65
}
64
66
65
67
#[ test]
You can’t perform that action at this time.
0 commit comments