44//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
55//!
66//! Mathematically significant numbers are provided in the `consts` sub-module.
7- //!
8- //! Although using these constants won’t cause compilation warnings,
9- //! new code should use the associated constants directly on the primitive type.
107
118#![ stable( feature = "rust1" , since = "1.0.0" ) ]
129
@@ -17,217 +14,131 @@ use crate::mem;
1714use crate :: num:: FpCategory ;
1815
1916/// The radix or base of the internal representation of `f32`.
20- /// Use [`f32::RADIX`](../../std/primitive.f32.html#associatedconstant.RADIX) instead.
21- ///
22- /// # Examples
23- ///
24- /// ```rust
25- /// // deprecated way
26- /// let r = std::f32::RADIX;
27- ///
28- /// // intended way
29- /// let r = f32::RADIX;
30- /// ```
3117#[ stable( feature = "rust1" , since = "1.0.0" ) ]
18+ #[ rustc_deprecated(
19+ since = "1.46.0" ,
20+ reason = "The associated constant `f32::RADIX` is now prefered" ,
21+ suggestion = "f32::RADIX" ,
22+ ) ]
3223pub const RADIX : u32 = f32:: RADIX ;
3324
3425/// Number of significant digits in base 2.
35- /// Use [`f32::MANTISSA_DIGITS`](../../std/primitive.f32.html#associatedconstant.MANTISSA_DIGITS) instead.
36- ///
37- /// # Examples
38- ///
39- /// ```rust
40- /// // deprecated way
41- /// let d = std::f32::MANTISSA_DIGITS;
42- ///
43- /// // intended way
44- /// let d = f32::MANTISSA_DIGITS;
45- /// ```
26+ #[ rustc_deprecated(
27+ since = "1.46.0" ,
28+ reason = "The associated constant `f32::MANTISSA_DIGITS` is now prefered" ,
29+ suggestion = "f32::MANTISSA_DIGITS" ,
30+ ) ]
4631#[ stable( feature = "rust1" , since = "1.0.0" ) ]
4732pub const MANTISSA_DIGITS : u32 = f32:: MANTISSA_DIGITS ;
4833
4934/// Approximate number of significant digits in base 10.
50- /// Use [`f32::DIGITS`](../../std/primitive.f32.html#associatedconstant.DIGITS) instead.
51- ///
52- /// # Examples
53- ///
54- /// ```rust
55- /// // deprecated way
56- /// let d = std::f32::DIGITS;
57- ///
58- /// // intended way
59- /// let d = f32::DIGITS;
60- /// ```
6135#[ stable( feature = "rust1" , since = "1.0.0" ) ]
36+ #[ rustc_deprecated(
37+ since = "1.46.0" ,
38+ reason = "The associated constant `f32::DIGITS` is now prefered" ,
39+ suggestion = "f32::DIGITS" ,
40+ ) ]
6241pub const DIGITS : u32 = f32:: DIGITS ;
6342
6443/// [Machine epsilon] value for `f32`.
65- /// Use [`f32::EPSILON`](../../std/primitive.f32.html#associatedconstant.EPSILON) instead.
66- ///
67- /// This is the difference between `1.0` and the next larger representable number.
6844///
6945/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
70- ///
71- /// # Examples
72- ///
73- /// ```rust
74- /// // deprecated way
75- /// let e = std::f32::EPSILON;
76- ///
77- /// // intended way
78- /// let e = f32::EPSILON;
79- /// ```
8046#[ stable( feature = "rust1" , since = "1.0.0" ) ]
47+ #[ rustc_deprecated(
48+ since = "1.46.0" ,
49+ reason = "The associated constant `f32::EPSILON` is now prefered" ,
50+ suggestion = "f32::EPSILON" ,
51+ ) ]
8152pub const EPSILON : f32 = f32:: EPSILON ;
8253
8354/// Smallest finite `f32` value.
84- /// Use [`f32::MIN`](../../std/primitive.f32.html#associatedconstant.MIN) instead.
85- ///
86- /// # Examples
87- ///
88- /// ```rust
89- /// // deprecated way
90- /// let min = std::f32::MIN;
91- ///
92- /// // intended way
93- /// let min = f32::MIN;
94- /// ```
9555#[ stable( feature = "rust1" , since = "1.0.0" ) ]
56+ #[ rustc_deprecated(
57+ since = "1.46.0" ,
58+ reason = "The associated constant `f32::MIN` is now prefered" ,
59+ suggestion = "f32::MIN" ,
60+ ) ]
9661pub const MIN : f32 = f32:: MIN ;
9762
9863/// Smallest positive normal `f32` value.
99- /// Use [`f32::MIN_POSITIVE`](../../std/primitive.f32.html#associatedconstant.MIN_POSITIVE) instead.
100- ///
101- /// # Examples
102- ///
103- /// ```rust
104- /// // deprecated way
105- /// let min = std::f32::MIN_POSITIVE;
106- ///
107- /// // intended way
108- /// let min = f32::MIN_POSITIVE;
109- /// ```
11064#[ stable( feature = "rust1" , since = "1.0.0" ) ]
65+ #[ rustc_deprecated(
66+ since = "1.46.0" ,
67+ reason = "The associated constant `f32::MIN_POSITIVE` is now prefered" ,
68+ suggestion = "f32::MIN_POSITIVE" ,
69+ ) ]
11170pub const MIN_POSITIVE : f32 = f32:: MIN_POSITIVE ;
11271
11372/// Largest finite `f32` value.
114- /// Use [`f32::MAX`](../../std/primitive.f32.html#associatedconstant.MAX) instead.
115- ///
116- /// # Examples
117- ///
118- /// ```rust
119- /// // deprecated way
120- /// let max = std::f32::MAX;
121- ///
122- /// // intended way
123- /// let max = f32::MAX;
124- /// ```
12573#[ stable( feature = "rust1" , since = "1.0.0" ) ]
74+ #[ rustc_deprecated(
75+ since = "1.46.0" ,
76+ reason = "The associated constant `f32::MAX` is now prefered" ,
77+ suggestion = "f32::MAX" ,
78+ ) ]
12679pub const MAX : f32 = f32:: MAX ;
12780
12881/// One greater than the minimum possible normal power of 2 exponent.
129- /// Use [`f32::MIN_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_EXP) instead.
130- ///
131- /// # Examples
132- ///
133- /// ```rust
134- /// // deprecated way
135- /// let min = std::f32::MIN_EXP;
136- ///
137- /// // intended way
138- /// let min = f32::MIN_EXP;
139- /// ```
14082#[ stable( feature = "rust1" , since = "1.0.0" ) ]
83+ #[ rustc_deprecated(
84+ since = "1.46.0" ,
85+ reason = "The associated constant `f32::MIN_EXP` is now prefered" ,
86+ suggestion = "f32::MIN_EXP" ,
87+ ) ]
14188pub const MIN_EXP : i32 = f32:: MIN_EXP ;
14289
14390/// Maximum possible power of 2 exponent.
144- /// Use [`f32::MAX_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_EXP) instead.
145- ///
146- /// # Examples
147- ///
148- /// ```rust
149- /// // deprecated way
150- /// let max = std::f32::MAX_EXP;
151- ///
152- /// // intended way
153- /// let max = f32::MAX_EXP;
154- /// ```
15591#[ stable( feature = "rust1" , since = "1.0.0" ) ]
92+ #[ rustc_deprecated(
93+ since = "1.46.0" ,
94+ reason = "The associated constant `f32::MAX_EXP` is now prefered" ,
95+ suggestion = "f32::MAX_EXP" ,
96+ ) ]
15697pub const MAX_EXP : i32 = f32:: MAX_EXP ;
15798
15899/// Minimum possible normal power of 10 exponent.
159- /// Use [`f32::MIN_10_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_10_EXP) instead.
160- ///
161- /// # Examples
162- ///
163- /// ```rust
164- /// // deprecated way
165- /// let min = std::f32::MIN_10_EXP;
166- ///
167- /// // intended way
168- /// let min = f32::MIN_10_EXP;
169- /// ```
170100#[ stable( feature = "rust1" , since = "1.0.0" ) ]
101+ #[ rustc_deprecated(
102+ since = "1.46.0" ,
103+ reason = "The associated constant `f32::MIN_10_EXP` is now prefered" ,
104+ suggestion = "f32::MIN_10_EXP" ,
105+ ) ]
171106pub const MIN_10_EXP : i32 = f32:: MIN_10_EXP ;
172107
173108/// Maximum possible power of 10 exponent.
174- /// Use [`f32::MAX_10_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_10_EXP) instead.
175- ///
176- /// # Examples
177- ///
178- /// ```rust
179- /// // deprecated way
180- /// let max = std::f32::MAX_10_EXP;
181- ///
182- /// // intended way
183- /// let max = f32::MAX_10_EXP;
184- /// ```
185109#[ stable( feature = "rust1" , since = "1.0.0" ) ]
110+ #[ rustc_deprecated(
111+ since = "1.46.0" ,
112+ reason = "The associated constant `f32::MAX_10_EXP` is now prefered" ,
113+ suggestion = "f32::MAX_10_EXP" ,
114+ ) ]
186115pub const MAX_10_EXP : i32 = f32:: MAX_10_EXP ;
187116
188117/// Not a Number (NaN).
189- /// Use [`f32::NAN`](../../std/primitive.f32.html#associatedconstant.NAN) instead.
190- ///
191- /// # Examples
192- ///
193- /// ```rust
194- /// // deprecated way
195- /// let nan = std::f32::NAN;
196- ///
197- /// // intended way
198- /// let nan = f32::NAN;
199- /// ```
200118#[ stable( feature = "rust1" , since = "1.0.0" ) ]
119+ #[ rustc_deprecated(
120+ since = "1.46.0" ,
121+ reason = "The associated constant `f32::NAN` is now prefered" ,
122+ suggestion = "f32::NAN" ,
123+ ) ]
201124pub const NAN : f32 = f32:: NAN ;
202125
203126/// Infinity (∞).
204- /// Use [`f32::INFINITY`](../../std/primitive.f32.html#associatedconstant.INFINITY) instead.
205- ///
206- /// # Examples
207- ///
208- /// ```rust
209- /// // deprecated way
210- /// let inf = std::f32::INFINITY;
211- ///
212- /// // intended way
213- /// let inf = f32::INFINITY;
214- /// ```
215127#[ stable( feature = "rust1" , since = "1.0.0" ) ]
128+ #[ rustc_deprecated(
129+ since = "1.46.0" ,
130+ reason = "The associated constant `f32::INFINITY` is now prefered" ,
131+ suggestion = "f32::INFINITY" ,
132+ ) ]
216133pub const INFINITY : f32 = f32:: INFINITY ;
217134
218135/// Negative infinity (−∞).
219- /// Use [`f32::NEG_INFINITY`](../../std/primitive.f32.html#associatedconstant.NEG_INFINITY) instead.
220- ///
221- /// # Examples
222- ///
223- /// ```rust
224- /// // deprecated way
225- /// let ninf = std::f32::NEG_INFINITY;
226- ///
227- /// // intended way
228- /// let ninf = f32::NEG_INFINITY;
229- /// ```
230136#[ stable( feature = "rust1" , since = "1.0.0" ) ]
137+ #[ rustc_deprecated(
138+ since = "1.46.0" ,
139+ reason = "The associated constant `f32::NEG_INFINITY` is now prefered" ,
140+ suggestion = "f32::NEG_INFINITY" ,
141+ ) ]
231142pub const NEG_INFINITY : f32 = f32:: NEG_INFINITY ;
232143
233144/// Basic mathematical constants.
0 commit comments