diff options
| author | Brian Anderson <banderson@mozilla.com> | 2015-01-12 18:40:19 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2015-01-21 16:16:18 -0800 |
| commit | 94ca8a361026d1a622a961e8dc8cacc331ed1ac3 (patch) | |
| tree | 58179e85714f0a1ee618a8a9982aadbeb65822cf /src/libstd/num/mod.rs | |
| parent | 90aa581cff54ed1bb5f53ee2ead3764fca94fdf3 (diff) | |
| download | rust-94ca8a361026d1a622a961e8dc8cacc331ed1ac3.tar.gz rust-94ca8a361026d1a622a961e8dc8cacc331ed1ac3.zip | |
Add 'feature' and 'since' to stability attributes
Diffstat (limited to 'src/libstd/num/mod.rs')
| -rw-r--r-- | src/libstd/num/mod.rs | 168 |
1 files changed, 96 insertions, 72 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 3432767d6cd..82363a8e169 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -13,7 +13,7 @@ //! These are implemented for the primitive numeric types in `std::{u8, u16, //! u32, u64, uint, i8, i16, i32, i64, int, f32, f64}`. -#![stable] +#![stable(feature = "grandfathered", since = "1.0.0")] #![allow(missing_docs)] #[cfg(test)] use fmt::Show; @@ -33,11 +33,11 @@ pub use core::num::{FpCategory}; use option::Option; -#[unstable = "may be removed or relocated"] +#[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "may be removed or relocated")] pub mod strconv; /// Mathematical operations on primitive floating point numbers. -#[stable] +#[stable(feature = "grandfathered", since = "1.0.0")] pub trait Float : Copy + Clone + NumCast @@ -52,172 +52,193 @@ pub trait Float { // inlined methods from `num::Float` /// Returns the NaN value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn nan() -> Self; /// Returns the infinite value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn infinity() -> Self; /// Returns the negative infinite value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn neg_infinity() -> Self; /// Returns the `0` value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn zero() -> Self; /// Returns -0.0. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn neg_zero() -> Self; /// Returns the `1` value. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn one() -> Self; // FIXME (#5527): These should be associated constants /// Returns the number of binary digits of mantissa that this type supports. - #[deprecated = "use `std::f32::MANTISSA_DIGITS` or `std::f64::MANTISSA_DIGITS` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::MANTISSA_DIGITS` or \ + `std::f64::MANTISSA_DIGITS` as appropriate")] fn mantissa_digits(unused_self: Option<Self>) -> uint; /// Returns the number of base-10 digits of precision that this type supports. - #[deprecated = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::DIGITS` or `std::f64::DIGITS` as appropriate")] fn digits(unused_self: Option<Self>) -> uint; /// Returns the difference between 1.0 and the smallest representable number larger than 1.0. - #[deprecated = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::EPSILON` or `std::f64::EPSILON` as appropriate")] fn epsilon() -> Self; /// Returns the minimum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::MIN_EXP` or `std::f64::MIN_EXP` as appropriate")] fn min_exp(unused_self: Option<Self>) -> int; /// Returns the maximum binary exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::MAX_EXP` or `std::f64::MAX_EXP` as appropriate")] fn max_exp(unused_self: Option<Self>) -> int; /// Returns the minimum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::MIN_10_EXP` or `std::f64::MIN_10_EXP` as appropriate")] fn min_10_exp(unused_self: Option<Self>) -> int; /// Returns the maximum base-10 exponent that this type can represent. - #[deprecated = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate"] + #[deprecated(feature = "oldstuff", since = "1.0.0", + reason = "use `std::f32::MAX_10_EXP` or `std::f64::MAX_10_EXP` as appropriate")] fn max_10_exp(unused_self: Option<Self>) -> int; /// Returns the smallest finite value that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn min_value() -> Self; /// Returns the smallest normalized positive number that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn min_pos_value(unused_self: Option<Self>) -> Self; /// Returns the largest finite value that this type can represent. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn max_value() -> Self; /// Returns true if this value is NaN and false otherwise. - #[unstable = "position is undecided"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "position is undecided")] fn is_nan(self) -> bool; /// Returns true if this value is positive infinity or negative infinity and /// false otherwise. - #[unstable = "position is undecided"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "position is undecided")] fn is_infinite(self) -> bool; /// Returns true if this number is neither infinite nor NaN. - #[unstable = "position is undecided"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "position is undecided")] fn is_finite(self) -> bool; /// Returns true if this number is neither zero, infinite, denormal, or NaN. - #[unstable = "position is undecided"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "position is undecided")] fn is_normal(self) -> bool; /// Returns the category that this number falls into. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn classify(self) -> FpCategory; /// Returns the mantissa, exponent and sign as integers, respectively. - #[unstable = "signature is undecided"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "signature is undecided")] fn integer_decode(self) -> (u64, i16, i8); /// Return the largest integer less than or equal to a number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn floor(self) -> Self; /// Return the smallest integer greater than or equal to a number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn ceil(self) -> Self; /// Return the nearest integer to a number. Round half-way cases away from /// `0.0`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn round(self) -> Self; /// Return the integer part of a number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn trunc(self) -> Self; /// Return the fractional part of a number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn fract(self) -> Self; /// Computes the absolute value of `self`. Returns `Float::nan()` if the /// number is `Float::nan()`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn abs(self) -> Self; /// Returns a number that represents the sign of `self`. /// /// - `1.0` if the number is positive, `+0.0` or `Float::infinity()` /// - `-1.0` if the number is negative, `-0.0` or `Float::neg_infinity()` /// - `Float::nan()` if the number is `Float::nan()` - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn signum(self) -> Self; /// Returns `true` if `self` is positive, including `+0.0` and /// `Float::infinity()`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn is_positive(self) -> bool; /// Returns `true` if `self` is negative, including `-0.0` and /// `Float::neg_infinity()`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn is_negative(self) -> bool; /// Fused multiply-add. Computes `(self * a) + b` with only one rounding /// error. This produces a more accurate result with better performance than /// a separate multiplication operation followed by an add. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn mul_add(self, a: Self, b: Self) -> Self; /// Take the reciprocal (inverse) of a number, `1/x`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn recip(self) -> Self; /// Raise a number to an integer power. /// /// Using this function is generally faster than using `powf` - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn powi(self, n: i32) -> Self; /// Raise a number to a floating point power. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn powf(self, n: Self) -> Self; /// Take the square root of a number. /// /// Returns NaN if `self` is a negative number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn sqrt(self) -> Self; /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn rsqrt(self) -> Self; /// Returns `e^(self)`, (the exponential function). - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn exp(self) -> Self; /// Returns 2 raised to the power of the number, `2^(self)`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn exp2(self) -> Self; /// Returns the natural logarithm of the number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn ln(self) -> Self; /// Returns the logarithm of the number with respect to an arbitrary base. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn log(self, base: Self) -> Self; /// Returns the base 2 logarithm of the number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn log2(self) -> Self; /// Returns the base 10 logarithm of the number. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn log10(self) -> Self; /// Convert radians to degrees. - #[unstable = "desirability is unclear"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "desirability is unclear")] fn to_degrees(self) -> Self; /// Convert degrees to radians. - #[unstable = "desirability is unclear"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "desirability is unclear")] fn to_radians(self) -> Self; /// Constructs a floating point number created by multiplying `x` by 2 /// raised to the power of `exp`. - #[unstable = "pending integer conventions"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "pending integer conventions")] fn ldexp(x: Self, exp: int) -> Self; /// Breaks the number into a normalized fraction and a base-2 exponent, /// satisfying: @@ -225,94 +246,97 @@ pub trait Float /// * `self = x * pow(2, exp)` /// /// * `0.5 <= abs(x) < 1.0` - #[unstable = "pending integer conventions"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "pending integer conventions")] fn frexp(self) -> (Self, int); /// Returns the next representable floating-point value in the direction of /// `other`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn next_after(self, other: Self) -> Self; /// Returns the maximum of the two numbers. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn max(self, other: Self) -> Self; /// Returns the minimum of the two numbers. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn min(self, other: Self) -> Self; /// The positive difference of two numbers. Returns `0.0` if the number is /// less than or equal to `other`, otherwise the difference between`self` /// and `other` is returned. - #[unstable = "may be renamed"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "may be renamed")] fn abs_sub(self, other: Self) -> Self; /// Take the cubic root of a number. - #[unstable = "may be renamed"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "may be renamed")] fn cbrt(self) -> Self; /// Calculate the length of the hypotenuse of a right-angle triangle given /// legs of length `x` and `y`. - #[unstable = "unsure about its place in the world"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", + reason = "unsure about its place in the world")] fn hypot(self, other: Self) -> Self; /// Computes the sine of a number (in radians). - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn sin(self) -> Self; /// Computes the cosine of a number (in radians). - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn cos(self) -> Self; /// Computes the tangent of a number (in radians). - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn tan(self) -> Self; /// Computes the arcsine of a number. Return value is in radians in /// the range [-pi/2, pi/2] or NaN if the number is outside the range /// [-1, 1]. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn asin(self) -> Self; /// Computes the arccosine of a number. Return value is in radians in /// the range [0, pi] or NaN if the number is outside the range /// [-1, 1]. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn acos(self) -> Self; /// Computes the arctangent of a number. Return value is in radians in the /// range [-pi/2, pi/2]; - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn atan(self) -> Self; /// Computes the four quadrant arctangent of a number, `y`, and another /// number `x`. Return value is in radians in the range [-pi, pi]. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn atan2(self, other: Self) -> Self; /// Simultaneously computes the sine and cosine of the number, `x`. Returns /// `(sin(x), cos(x))`. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn sin_cos(self) -> (Self, Self); /// Returns the exponential of the number, minus 1, in a way that is /// accurate even if the number is close to zero. - #[unstable = "may be renamed"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "may be renamed")] fn exp_m1(self) -> Self; /// Returns the natural logarithm of the number plus 1 (`ln(1+n)`) more /// accurately than if the operations were performed separately. - #[unstable = "may be renamed"] + #[unstable(feature = "unnamed_feature", since = "1.0.0", reason = "may be renamed")] fn ln_1p(self) -> Self; /// Hyperbolic sine function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn sinh(self) -> Self; /// Hyperbolic cosine function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn cosh(self) -> Self; /// Hyperbolic tangent function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn tanh(self) -> Self; /// Inverse hyperbolic sine function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn asinh(self) -> Self; /// Inverse hyperbolic cosine function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn acosh(self) -> Self; /// Inverse hyperbolic tangent function. - #[stable] + #[stable(feature = "grandfathered", since = "1.0.0")] fn atanh(self) -> Self; } |
