@@ -15,56 +15,70 @@ 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
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
19
+ pub const RADIX : u32 = f64:: RADIX ;
19
20
20
21
/// Number of significant digits in base 2.
21
22
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22
- pub const MANTISSA_DIGITS : u32 = 53 ;
23
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
24
+ pub const MANTISSA_DIGITS : u32 = f64:: MANTISSA_DIGITS ;
23
25
/// Approximate number of significant digits in base 10.
24
26
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
25
- pub const DIGITS : u32 = 15 ;
27
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
28
+ pub const DIGITS : u32 = f64:: DIGITS ;
26
29
27
30
/// [Machine epsilon] value for `f64`.
28
31
///
29
32
/// This is the difference between `1.0` and the next larger representable number.
30
33
///
31
34
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
32
35
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
33
- pub const EPSILON : f64 = 2.2204460492503131e-16_f64 ;
36
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
37
+ pub const EPSILON : f64 = f64:: EPSILON ;
34
38
35
39
/// Smallest finite `f64` value.
36
40
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
37
- pub const MIN : f64 = -1.7976931348623157e+308_f64 ;
41
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
42
+ pub const MIN : f64 = f64:: MIN ;
38
43
/// Smallest positive normal `f64` value.
39
44
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
- pub const MIN_POSITIVE : f64 = 2.2250738585072014e-308_f64 ;
45
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
46
+ pub const MIN_POSITIVE : f64 = f64:: MIN_POSITIVE ;
41
47
/// Largest finite `f64` value.
42
48
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
43
- pub const MAX : f64 = 1.7976931348623157e+308_f64 ;
49
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
50
+ pub const MAX : f64 = f64:: MAX ;
44
51
45
52
/// One greater than the minimum possible normal power of 2 exponent.
46
53
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
47
- pub const MIN_EXP : i32 = -1021 ;
54
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
55
+ pub const MIN_EXP : i32 = f64:: MIN_EXP ;
48
56
/// Maximum possible power of 2 exponent.
49
57
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
50
- pub const MAX_EXP : i32 = 1024 ;
58
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
59
+ pub const MAX_EXP : i32 = f64:: MAX_EXP ;
51
60
52
61
/// Minimum possible normal power of 10 exponent.
53
62
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
54
- pub const MIN_10_EXP : i32 = -307 ;
63
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
64
+ pub const MIN_10_EXP : i32 = f64:: MIN_10_EXP ;
55
65
/// Maximum possible power of 10 exponent.
56
66
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
57
- pub const MAX_10_EXP : i32 = 308 ;
67
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
68
+ pub const MAX_10_EXP : i32 = f64:: MAX_10_EXP ;
58
69
59
70
/// Not a Number (NaN).
60
71
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
61
- pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
72
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
73
+ pub const NAN : f64 = f64:: NAN ;
62
74
/// Infinity (∞).
63
75
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
64
- pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
76
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
77
+ pub const INFINITY : f64 = f64:: INFINITY ;
65
78
/// Negative infinity (−∞).
66
79
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
67
- pub const NEG_INFINITY : f64 = -1.0_f64 / 0.0_f64 ;
80
+ #[ rustc_deprecated( since = "1.42.0" , reason = "replaced by associated constant" ) ]
81
+ pub const NEG_INFINITY : f64 = f64:: NEG_INFINITY ;
68
82
69
83
/// Basic mathematical constants.
70
84
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -153,6 +167,59 @@ pub mod consts {
153
167
#[ lang = "f64" ]
154
168
#[ cfg( not( test) ) ]
155
169
impl f64 {
170
+ /// The radix or base of the internal representation of `f64`.
171
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
172
+ pub const RADIX : u32 = 2 ;
173
+
174
+ /// Number of significant digits in base 2.
175
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
176
+ pub const MANTISSA_DIGITS : u32 = 53 ;
177
+ /// Approximate number of significant digits in base 10.
178
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
179
+ pub const DIGITS : u32 = 15 ;
180
+
181
+ /// [Machine epsilon] value for `f64`.
182
+ ///
183
+ /// This is the difference between `1.0` and the next larger representable number.
184
+ ///
185
+ /// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
186
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
187
+ pub const EPSILON : f64 = 2.2204460492503131e-16_f64 ;
188
+
189
+ /// Smallest finite `f64` value.
190
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
191
+ pub const MIN : f64 = -1.7976931348623157e+308_f64 ;
192
+ /// Smallest positive normal `f64` value.
193
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
194
+ pub const MIN_POSITIVE : f64 = 2.2250738585072014e-308_f64 ;
195
+ /// Largest finite `f64` value.
196
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
197
+ pub const MAX : f64 = 1.7976931348623157e+308_f64 ;
198
+
199
+ /// One greater than the minimum possible normal power of 2 exponent.
200
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
201
+ pub const MIN_EXP : i32 = -1021 ;
202
+ /// Maximum possible power of 2 exponent.
203
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
204
+ pub const MAX_EXP : i32 = 1024 ;
205
+
206
+ /// Minimum possible normal power of 10 exponent.
207
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
208
+ pub const MIN_10_EXP : i32 = -307 ;
209
+ /// Maximum possible power of 10 exponent.
210
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
211
+ pub const MAX_10_EXP : i32 = 308 ;
212
+
213
+ /// Not a Number (NaN).
214
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
215
+ pub const NAN : f64 = 0.0_f64 / 0.0_f64 ;
216
+ /// Infinity (∞).
217
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
218
+ pub const INFINITY : f64 = 1.0_f64 / 0.0_f64 ;
219
+ /// Negative infinity (-∞).
220
+ #[ stable( feature = "assoc_int_consts" , since = "1.42.0" ) ]
221
+ pub const NEG_INFINITY : f64 = -1.0_f64 / 0.0_f64 ;
222
+
156
223
/// Returns `true` if this value is `NaN`.
157
224
///
158
225
/// ```
0 commit comments