@@ -18,15 +18,45 @@ use crate::num::FpCategory;
18
18
19
19
/// The radix or base of the internal representation of `f32`.
20
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
+ /// // correct way
29
+ /// let r = f32::RADIX;
30
+ /// ```
21
31
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22
32
pub const RADIX : u32 = f32:: RADIX ;
23
33
24
34
/// Number of significant digits in base 2.
25
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
+ /// // correct way
44
+ /// let d = f32::MANTISSA_DIGITS;
45
+ /// ```
26
46
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
27
47
pub const MANTISSA_DIGITS : u32 = f32:: MANTISSA_DIGITS ;
28
48
/// Approximate number of significant digits in base 10.
29
49
/// Use [`f32::DIGITS`](../../std/primitive.f32.html#associatedconstant.DIGITS) instead.
50
+ ///
51
+ /// # Examples
52
+ ///
53
+ /// ```rust
54
+ /// // deprecated way
55
+ /// let d = std::f32::DIGITS;
56
+ ///
57
+ /// // correct way
58
+ /// let d = f32::DIGITS;
59
+ /// ```
30
60
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
31
61
pub const DIGITS : u32 = f32:: DIGITS ;
32
62
@@ -36,50 +66,160 @@ pub const DIGITS: u32 = f32::DIGITS;
36
66
/// This is the difference between `1.0` and the next larger representable number.
37
67
///
38
68
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
69
+ ///
70
+ /// # Examples
71
+ ///
72
+ /// ```rust
73
+ /// // deprecated way
74
+ /// let e = std::f32::EPSILON;
75
+ ///
76
+ /// // correct way
77
+ /// let e = f32::EPSILON;
78
+ /// ```
39
79
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
80
pub const EPSILON : f32 = f32:: EPSILON ;
41
81
42
82
/// Smallest finite `f32` value.
43
83
/// Use [`f32::MIN`](../../std/primitive.f32.html#associatedconstant.MIN) instead.
84
+ ///
85
+ /// # Examples
86
+ ///
87
+ /// ```rust
88
+ /// // deprecated way
89
+ /// let min = std::f32::MIN;
90
+ ///
91
+ /// // correct way
92
+ /// let min = f32::MIN;
93
+ /// ```
44
94
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
45
95
pub const MIN : f32 = f32:: MIN ;
46
96
/// Smallest positive normal `f32` value.
47
97
/// Use [`f32::MIN_POSITIVE`](../../std/primitive.f32.html#associatedconstant.MIN_POSITIVE) instead.
98
+ ///
99
+ /// # Examples
100
+ ///
101
+ /// ```rust
102
+ /// // deprecated way
103
+ /// let min = std::f32::MIN_POSITIVE;
104
+ ///
105
+ /// // correct way
106
+ /// let min = f32::MIN_POSITIVE;
107
+ /// ```
48
108
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
49
109
pub const MIN_POSITIVE : f32 = f32:: MIN_POSITIVE ;
50
110
/// Largest finite `f32` value.
51
111
/// Use [`f32::MAX`](../../std/primitive.f32.html#associatedconstant.MAX) instead.
112
+ ///
113
+ /// # Examples
114
+ ///
115
+ /// ```rust
116
+ /// // deprecated way
117
+ /// let max = std::f32::MAX;
118
+ ///
119
+ /// // correct way
120
+ /// let max = f32::MAX;
121
+ /// ```
52
122
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
53
123
pub const MAX : f32 = f32:: MAX ;
54
124
55
125
/// One greater than the minimum possible normal power of 2 exponent.
56
126
/// Use [`f32::MIN_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_EXP) instead.
127
+ ///
128
+ /// # Examples
129
+ ///
130
+ /// ```rust
131
+ /// // deprecated way
132
+ /// let min = std::f32::MIN_EXP;
133
+ ///
134
+ /// // correct way
135
+ /// let min = f32::MIN_EXP;
136
+ /// ```
57
137
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
58
138
pub const MIN_EXP : i32 = f32:: MIN_EXP ;
59
139
/// Maximum possible power of 2 exponent.
60
140
/// Use [`f32::MAX_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_EXP) instead.
141
+ ///
142
+ /// # Examples
143
+ ///
144
+ /// ```rust
145
+ /// // deprecated way
146
+ /// let max = std::f32::MAX_EXP;
147
+ ///
148
+ /// // correct way
149
+ /// let max = f32::MAX_EXP;
150
+ /// ```
61
151
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
62
152
pub const MAX_EXP : i32 = f32:: MAX_EXP ;
63
153
64
154
/// Minimum possible normal power of 10 exponent.
65
155
/// Use [`f32::MIN_10_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_10_EXP) instead.
156
+ ///
157
+ /// # Examples
158
+ ///
159
+ /// ```rust
160
+ /// // deprecated way
161
+ /// let min = std::f32::MIN_10_EXP;
162
+ ///
163
+ /// // correct way
164
+ /// let min = f32::MIN_10_EXP;
165
+ /// ```
66
166
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
67
167
pub const MIN_10_EXP : i32 = f32:: MIN_10_EXP ;
68
168
/// Maximum possible power of 10 exponent.
69
169
/// Use [`f32::MAX_10_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_10_EXP) instead.
170
+ ///
171
+ /// # Examples
172
+ ///
173
+ /// ```rust
174
+ /// // deprecated way
175
+ /// let max = std::f32::MAX_10_EXP;
176
+ ///
177
+ /// // correct way
178
+ /// let max = f32::MAX_10_EXP;
179
+ /// ```
70
180
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
71
181
pub const MAX_10_EXP : i32 = f32:: MAX_10_EXP ;
72
182
73
183
/// Not a Number (NaN).
74
184
/// Use [`f32::NAN`](../../std/primitive.f32.html#associatedconstant.NAN) instead.
185
+ ///
186
+ /// # Examples
187
+ ///
188
+ /// ```rust
189
+ /// // deprecated way
190
+ /// let nan = std::f32::NAN;
191
+ ///
192
+ /// // correct way
193
+ /// let nan = f32::NAN;
194
+ /// ```
75
195
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
76
196
pub const NAN : f32 = f32:: NAN ;
77
197
/// Infinity (∞).
78
198
/// Use [`f32::INFINITY`](../../std/primitive.f32.html#associatedconstant.INFINITY) instead.
199
+ ///
200
+ /// # Examples
201
+ ///
202
+ /// ```rust
203
+ /// // deprecated way
204
+ /// let inf = std::f32::INFINITY;
205
+ ///
206
+ /// // correct way
207
+ /// let inf = f32::INFINITY;
208
+ /// ```
79
209
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
80
210
pub const INFINITY : f32 = f32:: INFINITY ;
81
211
/// Negative infinity (−∞).
82
212
/// Use [`f32::NEG_INFINITY`](../../std/primitive.f32.html#associatedconstant.NEG_INFINITY) instead.
213
+ ///
214
+ /// # Examples
215
+ ///
216
+ /// ```rust
217
+ /// // deprecated way
218
+ /// let ninf = std::f32::NEG_INFINITY;
219
+ ///
220
+ /// // correct way
221
+ /// let ninf = f32::NEG_INFINITY;
222
+ /// ```
83
223
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
84
224
pub const NEG_INFINITY : f32 = f32:: NEG_INFINITY ;
85
225
0 commit comments