@@ -37,6 +37,7 @@ use option::Option;
37
37
pub mod strconv;
38
38
39
39
/// Mathematical operations on primitive floating point numbers.
40
+ #[ stable]
40
41
pub trait Float
41
42
: Copy + Clone
42
43
+ NumCast
@@ -92,57 +93,58 @@ pub trait Float
92
93
/// Returns the maximum base-10 exponent that this type can represent.
93
94
#[ deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate" ]
94
95
fn max_10_exp ( unused_self : Option < Self > ) -> int ;
96
+
95
97
/// Returns the smallest finite value that this type can represent.
96
- #[ deprecated = "use `std::f32::MIN_VALUE` or `std::f64::MIN_VALUE` as appropriate " ]
98
+ #[ unstable = "unsure about its place in the world " ]
97
99
fn min_value ( ) -> Self ;
98
100
/// Returns the smallest normalized positive number that this type can represent.
99
- #[ deprecated = "use `std::f32::MIN_POS_VALUE` or `std::f64::MIN_POS_VALUE` as appropriate " ]
101
+ #[ unstable = "unsure about its place in the world " ]
100
102
fn min_pos_value ( unused_self : Option < Self > ) -> Self ;
101
103
/// Returns the largest finite value that this type can represent.
102
- #[ deprecated = "use `std::f32::MAX_VALUE` or `std::f64::MAX_VALUE` as appropriate " ]
104
+ #[ unstable = "unsure about its place in the world " ]
103
105
fn max_value ( ) -> Self ;
104
106
105
107
/// Returns true if this value is NaN and false otherwise.
106
- #[ stable ]
108
+ #[ unstable = "position is undecided" ]
107
109
fn is_nan ( self ) -> bool ;
108
110
/// Returns true if this value is positive infinity or negative infinity and
109
111
/// false otherwise.
110
- #[ stable ]
112
+ #[ unstable = "position is undecided" ]
111
113
fn is_infinite ( self ) -> bool ;
112
114
/// Returns true if this number is neither infinite nor NaN.
113
- #[ stable ]
115
+ #[ unstable = "position is undecided" ]
114
116
fn is_finite ( self ) -> bool ;
115
117
/// Returns true if this number is neither zero, infinite, denormal, or NaN.
116
- #[ stable ]
118
+ #[ unstable = "position is undecided" ]
117
119
fn is_normal ( self ) -> bool ;
118
120
/// Returns the category that this number falls into.
119
121
#[ stable]
120
122
fn classify ( self ) -> FpCategory ;
121
123
122
124
/// Returns the mantissa, exponent and sign as integers, respectively.
123
- #[ stable ]
125
+ #[ unstable = "signature is undecided" ]
124
126
fn integer_decode ( self ) -> ( u64 , i16 , i8 ) ;
125
127
126
128
/// Return the largest integer less than or equal to a number.
127
- #[ unstable = "TODO" ]
129
+ #[ stable ]
128
130
fn floor ( self ) -> Self ;
129
131
/// Return the smallest integer greater than or equal to a number.
130
- #[ unstable = "TODO" ]
132
+ #[ stable ]
131
133
fn ceil ( self ) -> Self ;
132
134
/// Return the nearest integer to a number. Round half-way cases away from
133
135
/// `0.0`.
134
- #[ unstable = "TODO" ]
136
+ #[ stable ]
135
137
fn round ( self ) -> Self ;
136
138
/// Return the integer part of a number.
137
- #[ unstable = "TODO" ]
139
+ #[ stable ]
138
140
fn trunc ( self ) -> Self ;
139
141
/// Return the fractional part of a number.
140
- #[ unstable = "TODO" ]
142
+ #[ stable ]
141
143
fn fract ( self ) -> Self ;
142
144
143
145
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
144
146
/// number is `Float::nan()`.
145
- #[ unstable = "TODO" ]
147
+ #[ stable ]
146
148
fn abs ( self ) -> Self ;
147
149
/// Returns a number that represents the sign of `self`.
148
150
///
@@ -163,130 +165,154 @@ pub trait Float
163
165
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
164
166
/// error. This produces a more accurate result with better performance than
165
167
/// a separate multiplication operation followed by an add.
166
- #[ stable ]
168
+ #[ unstable = "unsure about its place in the world" ]
167
169
fn mul_add ( self , a : Self , b : Self ) -> Self ;
168
170
/// Take the reciprocal (inverse) of a number, `1/x`.
169
- #[ stable ]
171
+ #[ unstable = "unsure about its place in the world" ]
170
172
fn recip ( self ) -> Self ;
171
173
172
174
/// Raise a number to an integer power.
173
175
///
174
176
/// Using this function is generally faster than using `powf`
175
- #[ unstable = "TODO" ]
177
+ #[ stable ]
176
178
fn powi ( self , n : i32 ) -> Self ;
177
179
/// Raise a number to a floating point power.
178
- #[ unstable = "TODO" ]
180
+ #[ stable ]
179
181
fn powf ( self , n : Self ) -> Self ;
180
182
181
183
/// Take the square root of a number.
182
184
///
183
185
/// Returns NaN if `self` is a negative number.
184
- #[ unstable = "TODO" ]
186
+ #[ stable ]
185
187
fn sqrt ( self ) -> Self ;
186
188
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
187
- #[ unstable = "TODO " ]
189
+ #[ unstable = "unsure about its place in the world " ]
188
190
fn rsqrt ( self ) -> Self ;
189
191
190
192
/// Returns `e^(self)`, (the exponential function).
191
- #[ unstable = "TODO" ]
193
+ #[ stable ]
192
194
fn exp ( self ) -> Self ;
193
195
/// Returns 2 raised to the power of the number, `2^(self)`.
194
- #[ unstable = "TODO" ]
196
+ #[ stable ]
195
197
fn exp2 ( self ) -> Self ;
196
198
/// Returns the natural logarithm of the number.
197
- #[ unstable = "TODO" ]
199
+ #[ stable ]
198
200
fn ln ( self ) -> Self ;
199
201
/// Returns the logarithm of the number with respect to an arbitrary base.
200
- #[ unstable = "TODO" ]
202
+ #[ stable ]
201
203
fn log ( self , base : Self ) -> Self ;
202
204
/// Returns the base 2 logarithm of the number.
203
- #[ unstable = "TODO" ]
205
+ #[ stable ]
204
206
fn log2 ( self ) -> Self ;
205
207
/// Returns the base 10 logarithm of the number.
206
- #[ unstable = "TODO" ]
208
+ #[ stable ]
207
209
fn log10 ( self ) -> Self ;
208
210
209
211
/// Convert radians to degrees.
210
- #[ unstable = "TODO " ]
212
+ #[ unstable = "desirability is unclear " ]
211
213
fn to_degrees ( self ) -> Self ;
212
214
/// Convert degrees to radians.
213
- #[ unstable = "TODO " ]
215
+ #[ unstable = "desirability is unclear " ]
214
216
fn to_radians ( self ) -> Self ;
215
217
216
218
/// Constructs a floating point number created by multiplying `x` by 2
217
219
/// raised to the power of `exp`.
220
+ #[ unstable = "pending integer conventions" ]
218
221
fn ldexp ( x : Self , exp : int ) -> Self ;
219
222
/// Breaks the number into a normalized fraction and a base-2 exponent,
220
223
/// satisfying:
221
224
///
222
225
/// * `self = x * pow(2, exp)`
223
226
///
224
227
/// * `0.5 <= abs(x) < 1.0`
228
+ #[ unstable = "pending integer conventions" ]
225
229
fn frexp ( self ) -> ( Self , int ) ;
226
230
227
231
/// Returns the next representable floating-point value in the direction of
228
232
/// `other`.
233
+ #[ unstable = "unsure about its place in the world" ]
229
234
fn next_after ( self , other : Self ) -> Self ;
230
235
231
236
/// Returns the maximum of the two numbers.
237
+ #[ stable]
232
238
fn max ( self , other : Self ) -> Self ;
233
239
/// Returns the minimum of the two numbers.
240
+ #[ stable]
234
241
fn min ( self , other : Self ) -> Self ;
235
242
236
243
/// The positive difference of two numbers. Returns `0.0` if the number is
237
244
/// less than or equal to `other`, otherwise the difference between`self`
238
245
/// and `other` is returned.
246
+ #[ unstable = "may be renamed" ]
239
247
fn abs_sub ( self , other : Self ) -> Self ;
240
248
241
249
/// Take the cubic root of a number.
250
+ #[ unstable = "may be renamed" ]
242
251
fn cbrt ( self ) -> Self ;
243
252
/// Calculate the length of the hypotenuse of a right-angle triangle given
244
253
/// legs of length `x` and `y`.
254
+ #[ unstable = "unsure about its place in the world" ]
245
255
fn hypot ( self , other : Self ) -> Self ;
246
256
247
257
/// Computes the sine of a number (in radians).
258
+ #[ stable]
248
259
fn sin ( self ) -> Self ;
249
260
/// Computes the cosine of a number (in radians).
261
+ #[ stable]
250
262
fn cos ( self ) -> Self ;
251
263
/// Computes the tangent of a number (in radians).
264
+ #[ stable]
252
265
fn tan ( self ) -> Self ;
253
266
254
267
/// Computes the arcsine of a number. Return value is in radians in
255
268
/// the range [-pi/2, pi/2] or NaN if the number is outside the range
256
269
/// [-1, 1].
270
+ #[ stable]
257
271
fn asin ( self ) -> Self ;
258
272
/// Computes the arccosine of a number. Return value is in radians in
259
273
/// the range [0, pi] or NaN if the number is outside the range
260
274
/// [-1, 1].
275
+ #[ stable]
261
276
fn acos ( self ) -> Self ;
262
277
/// Computes the arctangent of a number. Return value is in radians in the
263
278
/// range [-pi/2, pi/2];
279
+ #[ stable]
264
280
fn atan ( self ) -> Self ;
265
281
/// Computes the four quadrant arctangent of a number, `y`, and another
266
282
/// number `x`. Return value is in radians in the range [-pi, pi].
283
+ #[ stable]
267
284
fn atan2 ( self , other : Self ) -> Self ;
268
285
/// Simultaneously computes the sine and cosine of the number, `x`. Returns
269
286
/// `(sin(x), cos(x))`.
287
+ #[ stable]
270
288
fn sin_cos ( self ) -> ( Self , Self ) ;
271
289
272
290
/// Returns the exponential of the number, minus 1, in a way that is
273
291
/// accurate even if the number is close to zero.
292
+ #[ unstable = "may be renamed" ]
274
293
fn exp_m1 ( self ) -> Self ;
275
294
/// Returns the natural logarithm of the number plus 1 (`ln(1+n)`) more
276
295
/// accurately than if the operations were performed separately.
296
+ #[ unstable = "may be renamed" ]
277
297
fn ln_1p ( self ) -> Self ;
278
298
279
299
/// Hyperbolic sine function.
300
+ #[ stable]
280
301
fn sinh ( self ) -> Self ;
281
302
/// Hyperbolic cosine function.
303
+ #[ stable]
282
304
fn cosh ( self ) -> Self ;
283
305
/// Hyperbolic tangent function.
306
+ #[ stable]
284
307
fn tanh ( self ) -> Self ;
285
308
/// Inverse hyperbolic sine function.
309
+ #[ stable]
286
310
fn asinh ( self ) -> Self ;
287
311
/// Inverse hyperbolic cosine function.
312
+ #[ stable]
288
313
fn acosh ( self ) -> Self ;
289
314
/// Inverse hyperbolic tangent function.
315
+ #[ stable]
290
316
fn atanh ( self ) -> Self ;
291
317
}
292
318
0 commit comments