@@ -15,56 +15,70 @@ use crate::num::FpCategory;
1515
1616/// The radix or base of the internal representation of `f64`.
1717#[ 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 ;
1920
2021/// Number of significant digits in base 2.
2122#[ 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 ;
2325/// Approximate number of significant digits in base 10.
2426#[ 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 ;
2629
2730/// [Machine epsilon] value for `f64`.
2831///
2932/// This is the difference between `1.0` and the next larger representable number.
3033///
3134/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
3235#[ 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 ;
3438
3539/// Smallest finite `f64` value.
3640#[ 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 ;
3843/// Smallest positive normal `f64` value.
3944#[ 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 ;
4147/// Largest finite `f64` value.
4248#[ 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 ;
4451
4552/// One greater than the minimum possible normal power of 2 exponent.
4653#[ 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 ;
4856/// Maximum possible power of 2 exponent.
4957#[ 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 ;
5160
5261/// Minimum possible normal power of 10 exponent.
5362#[ 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 ;
5565/// Maximum possible power of 10 exponent.
5666#[ 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 ;
5869
5970/// Not a Number (NaN).
6071#[ 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 ;
6274/// Infinity (∞).
6375#[ 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 ;
6578/// Negative infinity (−∞).
6679#[ 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 ;
6882
6983/// Basic mathematical constants.
7084#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -153,6 +167,59 @@ pub mod consts {
153167#[ lang = "f64" ]
154168#[ cfg( not( test) ) ]
155169impl 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+
156223 /// Returns `true` if this value is `NaN`.
157224 ///
158225 /// ```
0 commit comments