@@ -18,15 +18,46 @@ 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
+ /// // intended 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
+ /// // intended 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 ;
48
+
28
49
/// Approximate number of significant digits in base 10.
29
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
+ /// ```
30
61
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
31
62
pub const DIGITS : u32 = f32:: DIGITS ;
32
63
@@ -36,50 +67,166 @@ pub const DIGITS: u32 = f32::DIGITS;
36
67
/// This is the difference between `1.0` and the next larger representable number.
37
68
///
38
69
/// [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
+ /// ```
39
80
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
40
81
pub const EPSILON : f32 = f32:: EPSILON ;
41
82
42
83
/// Smallest finite `f32` value.
43
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
+ /// ```
44
95
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
45
96
pub const MIN : f32 = f32:: MIN ;
97
+
46
98
/// Smallest positive normal `f32` value.
47
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
+ /// ```
48
110
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
49
111
pub const MIN_POSITIVE : f32 = f32:: MIN_POSITIVE ;
112
+
50
113
/// Largest finite `f32` value.
51
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
+ /// ```
52
125
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
53
126
pub const MAX : f32 = f32:: MAX ;
54
127
55
128
/// One greater than the minimum possible normal power of 2 exponent.
56
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
+ /// ```
57
140
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
58
141
pub const MIN_EXP : i32 = f32:: MIN_EXP ;
142
+
59
143
/// Maximum possible power of 2 exponent.
60
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
+ /// ```
61
155
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
62
156
pub const MAX_EXP : i32 = f32:: MAX_EXP ;
63
157
64
158
/// Minimum possible normal power of 10 exponent.
65
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
+ /// ```
66
170
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
67
171
pub const MIN_10_EXP : i32 = f32:: MIN_10_EXP ;
172
+
68
173
/// Maximum possible power of 10 exponent.
69
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
+ /// ```
70
185
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
71
186
pub const MAX_10_EXP : i32 = f32:: MAX_10_EXP ;
72
187
73
188
/// Not a Number (NaN).
74
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
+ /// ```
75
200
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
76
201
pub const NAN : f32 = f32:: NAN ;
202
+
77
203
/// Infinity (∞).
78
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
+ /// ```
79
215
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
80
216
pub const INFINITY : f32 = f32:: INFINITY ;
217
+
81
218
/// Negative infinity (−∞).
82
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
+ /// ```
83
230
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
84
231
pub const NEG_INFINITY : f32 = f32:: NEG_INFINITY ;
85
232
0 commit comments