@@ -15,56 +15,56 @@ use crate::num::FpCategory;
15
15
16
16
/// The radix or base of the internal representation of `f64`.
17
17
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
18
- pub const RADIX : u32 = 2 ;
18
+ pub const RADIX : u32 = f64 :: RADIX ;
19
19
20
20
/// Number of significant digits in base 2.
21
21
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22
- pub const MANTISSA_DIGITS : u32 = 53 ;
22
+ pub const MANTISSA_DIGITS : u32 = f64 :: MANTISSA_DIGITS ;
23
23
/// Approximate number of significant digits in base 10.
24
24
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
25
- pub const DIGITS : u32 = 15 ;
25
+ pub const DIGITS : u32 = f64 :: DIGITS ;
26
26
27
27
/// [Machine epsilon] value for `f64`.
28
28
///
29
29
/// This is the difference between `1.0` and the next larger representable number.
30
30
///
31
31
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
32
32
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
33
- pub const EPSILON : f64 = 2.2204460492503131e-16_f64 ;
33
+ pub const EPSILON : f64 = f64 :: EPSILON ;
34
34
35
35
/// Smallest finite `f64` value.
36
36
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
37
- pub const MIN : f64 = - 1.7976931348623157e+308_f64 ;
37
+ pub const MIN : f64 = f64 :: MIN ;
38
38
/// Smallest positive normal `f64` value.
39
39
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
- pub const MIN_POSITIVE : f64 = 2.2250738585072014e-308_f64 ;
40
+ pub const MIN_POSITIVE : f64 = f64 :: MIN_POSITIVE ;
41
41
/// Largest finite `f64` value.
42
42
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
43
- pub const MAX : f64 = 1.7976931348623157e+308_f64 ;
43
+ pub const MAX : f64 = f64 :: MAX ;
44
44
45
45
/// One greater than the minimum possible normal power of 2 exponent.
46
46
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
47
- pub const MIN_EXP : i32 = - 1021 ;
47
+ pub const MIN_EXP : i32 = f64 :: MIN_EXP ;
48
48
/// Maximum possible power of 2 exponent.
49
49
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
50
- pub const MAX_EXP : i32 = 1024 ;
50
+ pub const MAX_EXP : i32 = f64 :: MAX_EXP ;
51
51
52
52
/// Minimum possible normal power of 10 exponent.
53
53
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
54
- pub const MIN_10_EXP : i32 = - 307 ;
54
+ pub const MIN_10_EXP : i32 = f64 :: MIN_10_EXP ;
55
55
/// Maximum possible power of 10 exponent.
56
56
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
57
- pub const MAX_10_EXP : i32 = 308 ;
57
+ pub const MAX_10_EXP : i32 = f64 :: MAX_10_EXP ;
58
58
59
59
/// Not a Number (NaN).
60
60
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
61
- pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
61
+ pub const NAN : f64 = f64 :: NAN ;
62
62
/// Infinity (∞).
63
63
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
64
- pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
64
+ pub const INFINITY : f64 = f64 :: INFINITY ;
65
65
/// Negative infinity (−∞).
66
66
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
67
- pub const NEG_INFINITY : f64 = - 1.0_f64 / 0.0_f64 ;
67
+ pub const NEG_INFINITY : f64 = f64 :: NEG_INFINITY ;
68
68
69
69
/// Basic mathematical constants.
70
70
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -153,6 +153,59 @@ pub mod consts {
153
153
#[ lang = "f64" ]
154
154
#[ cfg( not( test) ) ]
155
155
impl f64 {
156
+ /// The radix or base of the internal representation of `f64`.
157
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
158
+ pub const RADIX : u32 = 2 ;
159
+
160
+ /// Number of significant digits in base 2.
161
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
162
+ pub const MANTISSA_DIGITS : u32 = 53 ;
163
+ /// Approximate number of significant digits in base 10.
164
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
165
+ pub const DIGITS : u32 = 15 ;
166
+
167
+ /// [Machine epsilon] value for `f64`.
168
+ ///
169
+ /// This is the difference between `1.0` and the next larger representable number.
170
+ ///
171
+ /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
172
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
173
+ pub const EPSILON : f64 = 2.2204460492503131e-16_f64 ;
174
+
175
+ /// Smallest finite `f64` value.
176
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
177
+ pub const MIN : f64 = -1.7976931348623157e+308_f64 ;
178
+ /// Smallest positive normal `f64` value.
179
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
180
+ pub const MIN_POSITIVE : f64 = 2.2250738585072014e-308_f64 ;
181
+ /// Largest finite `f64` value.
182
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
183
+ pub const MAX : f64 = 1.7976931348623157e+308_f64 ;
184
+
185
+ /// One greater than the minimum possible normal power of 2 exponent.
186
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
187
+ pub const MIN_EXP : i32 = -1021 ;
188
+ /// Maximum possible power of 2 exponent.
189
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
190
+ pub const MAX_EXP : i32 = 1024 ;
191
+
192
+ /// Minimum possible normal power of 10 exponent.
193
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
194
+ pub const MIN_10_EXP : i32 = -307 ;
195
+ /// Maximum possible power of 10 exponent.
196
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
197
+ pub const MAX_10_EXP : i32 = 308 ;
198
+
199
+ /// Not a Number (NaN).
200
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
201
+ pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
202
+ /// Infinity (∞).
203
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
204
+ pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
205
+ /// Negative infinity (-∞).
206
+ #[ unstable( feature = "assoc_int_consts" , reason = "recently added" , issue = "68490" ) ]
207
+ pub const NEG_INFINITY : f64 = -1.0_f64 / 0.0_f64 ;
208
+
156
209
/// Returns `true` if this value is `NaN`.
157
210
///
158
211
/// ```
0 commit comments