Skip to content

Commit 65922dd

Browse files
committed
Apply stability attributes to std::num::Float.
1 parent ae47627 commit 65922dd

File tree

3 files changed

+56
-30
lines changed

3 files changed

+56
-30
lines changed

src/libstd/num/f32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ mod cmath {
7373
}
7474
}
7575

76-
#[unstable = "trait is unstable"]
76+
#[stable]
7777
impl Float for f32 {
7878
#[inline]
7979
fn nan() -> f32 { num::Float::nan() }

src/libstd/num/f64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ mod cmath {
8181
}
8282
}
8383

84-
#[unstable = "trait is unstable"]
84+
#[stable]
8585
impl Float for f64 {
8686
// inlined methods from `num::Float`
8787
#[inline]

src/libstd/num/mod.rs

+54-28
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use option::Option;
3737
pub mod strconv;
3838

3939
/// Mathematical operations on primitive floating point numbers.
40+
#[stable]
4041
pub trait Float
4142
: Copy + Clone
4243
+ NumCast
@@ -92,57 +93,58 @@ pub trait Float
9293
/// Returns the maximum base-10 exponent that this type can represent.
9394
#[deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate"]
9495
fn max_10_exp(unused_self: Option<Self>) -> int;
96+
9597
/// 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"]
9799
fn min_value() -> Self;
98100
/// 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"]
100102
fn min_pos_value(unused_self: Option<Self>) -> Self;
101103
/// 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"]
103105
fn max_value() -> Self;
104106

105107
/// Returns true if this value is NaN and false otherwise.
106-
#[stable]
108+
#[unstable = "position is undecided"]
107109
fn is_nan(self) -> bool;
108110
/// Returns true if this value is positive infinity or negative infinity and
109111
/// false otherwise.
110-
#[stable]
112+
#[unstable = "position is undecided"]
111113
fn is_infinite(self) -> bool;
112114
/// Returns true if this number is neither infinite nor NaN.
113-
#[stable]
115+
#[unstable = "position is undecided"]
114116
fn is_finite(self) -> bool;
115117
/// Returns true if this number is neither zero, infinite, denormal, or NaN.
116-
#[stable]
118+
#[unstable = "position is undecided"]
117119
fn is_normal(self) -> bool;
118120
/// Returns the category that this number falls into.
119121
#[stable]
120122
fn classify(self) -> FpCategory;
121123

122124
/// Returns the mantissa, exponent and sign as integers, respectively.
123-
#[stable]
125+
#[unstable = "signature is undecided"]
124126
fn integer_decode(self) -> (u64, i16, i8);
125127

126128
/// Return the largest integer less than or equal to a number.
127-
#[unstable = "TODO"]
129+
#[stable]
128130
fn floor(self) -> Self;
129131
/// Return the smallest integer greater than or equal to a number.
130-
#[unstable = "TODO"]
132+
#[stable]
131133
fn ceil(self) -> Self;
132134
/// Return the nearest integer to a number. Round half-way cases away from
133135
/// `0.0`.
134-
#[unstable = "TODO"]
136+
#[stable]
135137
fn round(self) -> Self;
136138
/// Return the integer part of a number.
137-
#[unstable = "TODO"]
139+
#[stable]
138140
fn trunc(self) -> Self;
139141
/// Return the fractional part of a number.
140-
#[unstable = "TODO"]
142+
#[stable]
141143
fn fract(self) -> Self;
142144

143145
/// Computes the absolute value of `self`. Returns `Float::nan()` if the
144146
/// number is `Float::nan()`.
145-
#[unstable = "TODO"]
147+
#[stable]
146148
fn abs(self) -> Self;
147149
/// Returns a number that represents the sign of `self`.
148150
///
@@ -163,130 +165,154 @@ pub trait Float
163165
/// Fused multiply-add. Computes `(self * a) + b` with only one rounding
164166
/// error. This produces a more accurate result with better performance than
165167
/// a separate multiplication operation followed by an add.
166-
#[stable]
168+
#[unstable = "unsure about its place in the world"]
167169
fn mul_add(self, a: Self, b: Self) -> Self;
168170
/// Take the reciprocal (inverse) of a number, `1/x`.
169-
#[stable]
171+
#[unstable = "unsure about its place in the world"]
170172
fn recip(self) -> Self;
171173

172174
/// Raise a number to an integer power.
173175
///
174176
/// Using this function is generally faster than using `powf`
175-
#[unstable = "TODO"]
177+
#[stable]
176178
fn powi(self, n: i32) -> Self;
177179
/// Raise a number to a floating point power.
178-
#[unstable = "TODO"]
180+
#[stable]
179181
fn powf(self, n: Self) -> Self;
180182

181183
/// Take the square root of a number.
182184
///
183185
/// Returns NaN if `self` is a negative number.
184-
#[unstable = "TODO"]
186+
#[stable]
185187
fn sqrt(self) -> Self;
186188
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
187-
#[unstable = "TODO"]
189+
#[unstable = "unsure about its place in the world"]
188190
fn rsqrt(self) -> Self;
189191

190192
/// Returns `e^(self)`, (the exponential function).
191-
#[unstable = "TODO"]
193+
#[stable]
192194
fn exp(self) -> Self;
193195
/// Returns 2 raised to the power of the number, `2^(self)`.
194-
#[unstable = "TODO"]
196+
#[stable]
195197
fn exp2(self) -> Self;
196198
/// Returns the natural logarithm of the number.
197-
#[unstable = "TODO"]
199+
#[stable]
198200
fn ln(self) -> Self;
199201
/// Returns the logarithm of the number with respect to an arbitrary base.
200-
#[unstable = "TODO"]
202+
#[stable]
201203
fn log(self, base: Self) -> Self;
202204
/// Returns the base 2 logarithm of the number.
203-
#[unstable = "TODO"]
205+
#[stable]
204206
fn log2(self) -> Self;
205207
/// Returns the base 10 logarithm of the number.
206-
#[unstable = "TODO"]
208+
#[stable]
207209
fn log10(self) -> Self;
208210

209211
/// Convert radians to degrees.
210-
#[unstable = "TODO"]
212+
#[unstable = "desirability is unclear"]
211213
fn to_degrees(self) -> Self;
212214
/// Convert degrees to radians.
213-
#[unstable = "TODO"]
215+
#[unstable = "desirability is unclear"]
214216
fn to_radians(self) -> Self;
215217

216218
/// Constructs a floating point number created by multiplying `x` by 2
217219
/// raised to the power of `exp`.
220+
#[unstable = "pending integer conventions"]
218221
fn ldexp(x: Self, exp: int) -> Self;
219222
/// Breaks the number into a normalized fraction and a base-2 exponent,
220223
/// satisfying:
221224
///
222225
/// * `self = x * pow(2, exp)`
223226
///
224227
/// * `0.5 <= abs(x) < 1.0`
228+
#[unstable = "pending integer conventions"]
225229
fn frexp(self) -> (Self, int);
226230

227231
/// Returns the next representable floating-point value in the direction of
228232
/// `other`.
233+
#[unstable = "unsure about its place in the world"]
229234
fn next_after(self, other: Self) -> Self;
230235

231236
/// Returns the maximum of the two numbers.
237+
#[stable]
232238
fn max(self, other: Self) -> Self;
233239
/// Returns the minimum of the two numbers.
240+
#[stable]
234241
fn min(self, other: Self) -> Self;
235242

236243
/// The positive difference of two numbers. Returns `0.0` if the number is
237244
/// less than or equal to `other`, otherwise the difference between`self`
238245
/// and `other` is returned.
246+
#[unstable = "may be renamed"]
239247
fn abs_sub(self, other: Self) -> Self;
240248

241249
/// Take the cubic root of a number.
250+
#[unstable = "may be renamed"]
242251
fn cbrt(self) -> Self;
243252
/// Calculate the length of the hypotenuse of a right-angle triangle given
244253
/// legs of length `x` and `y`.
254+
#[unstable = "unsure about its place in the world"]
245255
fn hypot(self, other: Self) -> Self;
246256

247257
/// Computes the sine of a number (in radians).
258+
#[stable]
248259
fn sin(self) -> Self;
249260
/// Computes the cosine of a number (in radians).
261+
#[stable]
250262
fn cos(self) -> Self;
251263
/// Computes the tangent of a number (in radians).
264+
#[stable]
252265
fn tan(self) -> Self;
253266

254267
/// Computes the arcsine of a number. Return value is in radians in
255268
/// the range [-pi/2, pi/2] or NaN if the number is outside the range
256269
/// [-1, 1].
270+
#[stable]
257271
fn asin(self) -> Self;
258272
/// Computes the arccosine of a number. Return value is in radians in
259273
/// the range [0, pi] or NaN if the number is outside the range
260274
/// [-1, 1].
275+
#[stable]
261276
fn acos(self) -> Self;
262277
/// Computes the arctangent of a number. Return value is in radians in the
263278
/// range [-pi/2, pi/2];
279+
#[stable]
264280
fn atan(self) -> Self;
265281
/// Computes the four quadrant arctangent of a number, `y`, and another
266282
/// number `x`. Return value is in radians in the range [-pi, pi].
283+
#[stable]
267284
fn atan2(self, other: Self) -> Self;
268285
/// Simultaneously computes the sine and cosine of the number, `x`. Returns
269286
/// `(sin(x), cos(x))`.
287+
#[stable]
270288
fn sin_cos(self) -> (Self, Self);
271289

272290
/// Returns the exponential of the number, minus 1, in a way that is
273291
/// accurate even if the number is close to zero.
292+
#[unstable = "may be renamed"]
274293
fn exp_m1(self) -> Self;
275294
/// Returns the natural logarithm of the number plus 1 (`ln(1+n)`) more
276295
/// accurately than if the operations were performed separately.
296+
#[unstable = "may be renamed"]
277297
fn ln_1p(self) -> Self;
278298

279299
/// Hyperbolic sine function.
300+
#[stable]
280301
fn sinh(self) -> Self;
281302
/// Hyperbolic cosine function.
303+
#[stable]
282304
fn cosh(self) -> Self;
283305
/// Hyperbolic tangent function.
306+
#[stable]
284307
fn tanh(self) -> Self;
285308
/// Inverse hyperbolic sine function.
309+
#[stable]
286310
fn asinh(self) -> Self;
287311
/// Inverse hyperbolic cosine function.
312+
#[stable]
288313
fn acosh(self) -> Self;
289314
/// Inverse hyperbolic tangent function.
315+
#[stable]
290316
fn atanh(self) -> Self;
291317
}
292318

0 commit comments

Comments
 (0)