1
- //! This module provides constants which are specific to the implementation
2
- //! of the `f32` floating point data type.
1
+ //! Constants specific to the `f32` single-precision floating point type.
3
2
//!
4
3
//! *[See also the `f32` primitive type](../../std/primitive.f32.html).*
5
4
//!
6
5
//! Mathematically significant numbers are provided in the `consts` sub-module.
7
6
//!
8
- //! Although using these constants won’t cause compilation warnings,
9
- //! new code should use the associated constants directly on the primitive type.
7
+ //! For the constants defined directly in this module
8
+ //! (as distinct from those defined in the `consts` sub-module),
9
+ //! new code should instead use the associated constants
10
+ //! defined directly on the `f32` type.
10
11
11
12
#![ stable( feature = "rust1" , since = "1.0.0" ) ]
12
13
@@ -23,12 +24,14 @@ use crate::num::FpCategory;
23
24
///
24
25
/// ```rust
25
26
/// // deprecated way
27
+ /// # #[allow(deprecated, deprecated_in_future)]
26
28
/// let r = std::f32::RADIX;
27
29
///
28
30
/// // intended way
29
31
/// let r = f32::RADIX;
30
32
/// ```
31
33
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
34
+ #[ rustc_deprecated( since = "TBD" , reason = "replaced by the `RADIX` associated constant on `f32`" ) ]
32
35
pub const RADIX : u32 = f32:: RADIX ;
33
36
34
37
/// Number of significant digits in base 2.
@@ -38,12 +41,17 @@ pub const RADIX: u32 = f32::RADIX;
38
41
///
39
42
/// ```rust
40
43
/// // deprecated way
44
+ /// # #[allow(deprecated, deprecated_in_future)]
41
45
/// let d = std::f32::MANTISSA_DIGITS;
42
46
///
43
47
/// // intended way
44
48
/// let d = f32::MANTISSA_DIGITS;
45
49
/// ```
46
50
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
51
+ #[ rustc_deprecated(
52
+ since = "TBD" ,
53
+ reason = "replaced by the `MANTISSA_DIGITS` associated constant on `f32`"
54
+ ) ]
47
55
pub const MANTISSA_DIGITS : u32 = f32:: MANTISSA_DIGITS ;
48
56
49
57
/// Approximate number of significant digits in base 10.
@@ -53,12 +61,14 @@ pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
53
61
///
54
62
/// ```rust
55
63
/// // deprecated way
64
+ /// # #[allow(deprecated, deprecated_in_future)]
56
65
/// let d = std::f32::DIGITS;
57
66
///
58
67
/// // intended way
59
68
/// let d = f32::DIGITS;
60
69
/// ```
61
70
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
71
+ #[ rustc_deprecated( since = "TBD" , reason = "replaced by the `DIGITS` associated constant on `f32`" ) ]
62
72
pub const DIGITS : u32 = f32:: DIGITS ;
63
73
64
74
/// [Machine epsilon] value for `f32`.
@@ -72,12 +82,17 @@ pub const DIGITS: u32 = f32::DIGITS;
72
82
///
73
83
/// ```rust
74
84
/// // deprecated way
85
+ /// # #[allow(deprecated, deprecated_in_future)]
75
86
/// let e = std::f32::EPSILON;
76
87
///
77
88
/// // intended way
78
89
/// let e = f32::EPSILON;
79
90
/// ```
80
91
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
92
+ #[ rustc_deprecated(
93
+ since = "TBD" ,
94
+ reason = "replaced by the `EPSILON` associated constant on `f32`"
95
+ ) ]
81
96
pub const EPSILON : f32 = f32:: EPSILON ;
82
97
83
98
/// Smallest finite `f32` value.
@@ -87,12 +102,14 @@ pub const EPSILON: f32 = f32::EPSILON;
87
102
///
88
103
/// ```rust
89
104
/// // deprecated way
105
+ /// # #[allow(deprecated, deprecated_in_future)]
90
106
/// let min = std::f32::MIN;
91
107
///
92
108
/// // intended way
93
109
/// let min = f32::MIN;
94
110
/// ```
95
111
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
112
+ #[ rustc_deprecated( since = "TBD" , reason = "replaced by the `MIN` associated constant on `f32`" ) ]
96
113
pub const MIN : f32 = f32:: MIN ;
97
114
98
115
/// Smallest positive normal `f32` value.
@@ -102,12 +119,17 @@ pub const MIN: f32 = f32::MIN;
102
119
///
103
120
/// ```rust
104
121
/// // deprecated way
122
+ /// # #[allow(deprecated, deprecated_in_future)]
105
123
/// let min = std::f32::MIN_POSITIVE;
106
124
///
107
125
/// // intended way
108
126
/// let min = f32::MIN_POSITIVE;
109
127
/// ```
110
128
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
129
+ #[ rustc_deprecated(
130
+ since = "TBD" ,
131
+ reason = "replaced by the `MIN_POSITIVE` associated constant on `f32`"
132
+ ) ]
111
133
pub const MIN_POSITIVE : f32 = f32:: MIN_POSITIVE ;
112
134
113
135
/// Largest finite `f32` value.
@@ -117,12 +139,14 @@ pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
117
139
///
118
140
/// ```rust
119
141
/// // deprecated way
142
+ /// # #[allow(deprecated, deprecated_in_future)]
120
143
/// let max = std::f32::MAX;
121
144
///
122
145
/// // intended way
123
146
/// let max = f32::MAX;
124
147
/// ```
125
148
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
149
+ #[ rustc_deprecated( since = "TBD" , reason = "replaced by the `MAX` associated constant on `f32`" ) ]
126
150
pub const MAX : f32 = f32:: MAX ;
127
151
128
152
/// One greater than the minimum possible normal power of 2 exponent.
@@ -132,12 +156,17 @@ pub const MAX: f32 = f32::MAX;
132
156
///
133
157
/// ```rust
134
158
/// // deprecated way
159
+ /// # #[allow(deprecated, deprecated_in_future)]
135
160
/// let min = std::f32::MIN_EXP;
136
161
///
137
162
/// // intended way
138
163
/// let min = f32::MIN_EXP;
139
164
/// ```
140
165
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
166
+ #[ rustc_deprecated(
167
+ since = "TBD" ,
168
+ reason = "replaced by the `MIN_EXP` associated constant on `f32`"
169
+ ) ]
141
170
pub const MIN_EXP : i32 = f32:: MIN_EXP ;
142
171
143
172
/// Maximum possible power of 2 exponent.
@@ -147,12 +176,17 @@ pub const MIN_EXP: i32 = f32::MIN_EXP;
147
176
///
148
177
/// ```rust
149
178
/// // deprecated way
179
+ /// # #[allow(deprecated, deprecated_in_future)]
150
180
/// let max = std::f32::MAX_EXP;
151
181
///
152
182
/// // intended way
153
183
/// let max = f32::MAX_EXP;
154
184
/// ```
155
185
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
186
+ #[ rustc_deprecated(
187
+ since = "TBD" ,
188
+ reason = "replaced by the `MAX_EXP` associated constant on `f32`"
189
+ ) ]
156
190
pub const MAX_EXP : i32 = f32:: MAX_EXP ;
157
191
158
192
/// Minimum possible normal power of 10 exponent.
@@ -162,12 +196,17 @@ pub const MAX_EXP: i32 = f32::MAX_EXP;
162
196
///
163
197
/// ```rust
164
198
/// // deprecated way
199
+ /// # #[allow(deprecated, deprecated_in_future)]
165
200
/// let min = std::f32::MIN_10_EXP;
166
201
///
167
202
/// // intended way
168
203
/// let min = f32::MIN_10_EXP;
169
204
/// ```
170
205
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
206
+ #[ rustc_deprecated(
207
+ since = "TBD" ,
208
+ reason = "replaced by the `MIN_10_EXP` associated constant on `f32`"
209
+ ) ]
171
210
pub const MIN_10_EXP : i32 = f32:: MIN_10_EXP ;
172
211
173
212
/// Maximum possible power of 10 exponent.
@@ -177,12 +216,17 @@ pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
177
216
///
178
217
/// ```rust
179
218
/// // deprecated way
219
+ /// # #[allow(deprecated, deprecated_in_future)]
180
220
/// let max = std::f32::MAX_10_EXP;
181
221
///
182
222
/// // intended way
183
223
/// let max = f32::MAX_10_EXP;
184
224
/// ```
185
225
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
226
+ #[ rustc_deprecated(
227
+ since = "TBD" ,
228
+ reason = "replaced by the `MAX_10_EXP` associated constant on `f32`"
229
+ ) ]
186
230
pub const MAX_10_EXP : i32 = f32:: MAX_10_EXP ;
187
231
188
232
/// Not a Number (NaN).
@@ -192,12 +236,14 @@ pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
192
236
///
193
237
/// ```rust
194
238
/// // deprecated way
239
+ /// # #[allow(deprecated, deprecated_in_future)]
195
240
/// let nan = std::f32::NAN;
196
241
///
197
242
/// // intended way
198
243
/// let nan = f32::NAN;
199
244
/// ```
200
245
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
246
+ #[ rustc_deprecated( since = "TBD" , reason = "replaced by the `NAN` associated constant on `f32`" ) ]
201
247
pub const NAN : f32 = f32:: NAN ;
202
248
203
249
/// Infinity (∞).
@@ -207,12 +253,17 @@ pub const NAN: f32 = f32::NAN;
207
253
///
208
254
/// ```rust
209
255
/// // deprecated way
256
+ /// # #[allow(deprecated, deprecated_in_future)]
210
257
/// let inf = std::f32::INFINITY;
211
258
///
212
259
/// // intended way
213
260
/// let inf = f32::INFINITY;
214
261
/// ```
215
262
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
263
+ #[ rustc_deprecated(
264
+ since = "TBD" ,
265
+ reason = "replaced by the `INFINITY` associated constant on `f32`"
266
+ ) ]
216
267
pub const INFINITY : f32 = f32:: INFINITY ;
217
268
218
269
/// Negative infinity (−∞).
@@ -222,12 +273,17 @@ pub const INFINITY: f32 = f32::INFINITY;
222
273
///
223
274
/// ```rust
224
275
/// // deprecated way
276
+ /// # #[allow(deprecated, deprecated_in_future)]
225
277
/// let ninf = std::f32::NEG_INFINITY;
226
278
///
227
279
/// // intended way
228
280
/// let ninf = f32::NEG_INFINITY;
229
281
/// ```
230
282
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
283
+ #[ rustc_deprecated(
284
+ since = "TBD" ,
285
+ reason = "replaced by the `NEG_INFINITY` associated constant on `f32`"
286
+ ) ]
231
287
pub const NEG_INFINITY : f32 = f32:: NEG_INFINITY ;
232
288
233
289
/// Basic mathematical constants.
0 commit comments