4
4
//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
5
5
//!
6
6
//! 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.
10
7
11
8
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
12
9
@@ -17,217 +14,131 @@ use crate::mem;
17
14
use crate :: num:: FpCategory ;
18
15
19
16
/// 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
- /// ```
31
17
#[ 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
+ ) ]
32
23
pub const RADIX : u32 = f32:: RADIX ;
33
24
34
25
/// 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
+ ) ]
46
31
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
47
32
pub const MANTISSA_DIGITS : u32 = f32:: MANTISSA_DIGITS ;
48
33
49
34
/// 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
- /// ```
61
35
#[ 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
+ ) ]
62
41
pub const DIGITS : u32 = f32:: DIGITS ;
63
42
64
43
/// [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.
68
44
///
69
45
/// [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
- /// ```
80
46
#[ 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
+ ) ]
81
52
pub const EPSILON : f32 = f32:: EPSILON ;
82
53
83
54
/// 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
- /// ```
95
55
#[ 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
+ ) ]
96
61
pub const MIN : f32 = f32:: MIN ;
97
62
98
63
/// 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
- /// ```
110
64
#[ 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
+ ) ]
111
70
pub const MIN_POSITIVE : f32 = f32:: MIN_POSITIVE ;
112
71
113
72
/// 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
- /// ```
125
73
#[ 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
+ ) ]
126
79
pub const MAX : f32 = f32:: MAX ;
127
80
128
81
/// 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
- /// ```
140
82
#[ 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
+ ) ]
141
88
pub const MIN_EXP : i32 = f32:: MIN_EXP ;
142
89
143
90
/// 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
- /// ```
155
91
#[ 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
+ ) ]
156
97
pub const MAX_EXP : i32 = f32:: MAX_EXP ;
157
98
158
99
/// 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
- /// ```
170
100
#[ 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
+ ) ]
171
106
pub const MIN_10_EXP : i32 = f32:: MIN_10_EXP ;
172
107
173
108
/// 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
- /// ```
185
109
#[ 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
+ ) ]
186
115
pub const MAX_10_EXP : i32 = f32:: MAX_10_EXP ;
187
116
188
117
/// 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
- /// ```
200
118
#[ 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
+ ) ]
201
124
pub const NAN : f32 = f32:: NAN ;
202
125
203
126
/// 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
- /// ```
215
127
#[ 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
+ ) ]
216
133
pub const INFINITY : f32 = f32:: INFINITY ;
217
134
218
135
/// 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
- /// ```
230
136
#[ 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
+ ) ]
231
142
pub const NEG_INFINITY : f32 = f32:: NEG_INFINITY ;
232
143
233
144
/// Basic mathematical constants.
0 commit comments