about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-06 13:30:29 +0000
committerbors <bors@rust-lang.org>2015-01-06 13:30:29 +0000
commit8efd9901b628d687d11a4d0ccc153553b38ada49 (patch)
treef6b1a31cdbbc5a5873b0b7d549f4842ddf888a83 /src/libstd
parent340ac040f7603e169a3739c65956ed2213622be5 (diff)
parentf3a80ab9d2f6ce61c4b7500fb23f4c6f59175770 (diff)
downloadrust-8efd9901b628d687d11a4d0ccc153553b38ada49.tar.gz
rust-8efd9901b628d687d11a4d0ccc153553b38ada49.zip
auto merge of #20573 : huonw/rust/num-stab-2, r=alexcrichton
cc #19260 

Open questions:

- I still feel weird about marking functions like `exp` as `#[stable]` in `core` since they're highly likely to call into libm which is theoretically something core is designed to avoid and so we may be forced/want to move it at some point in the future, and so it feels like a lie to call it `#[stable]` (I know `core` is `#[experimental]`, but still...)
- `abs_sub` is a horrible name IMO: it feels like it is `(a - b).abs()`, but it is actually `(a - b).max(0.)`. maybe something along the lines of `pos_diff` ("positive difference") is better.
- the associated-function nature of `Int::from_be` and `Int::from_le` feel strange to me, it feels like they should be methods, but I cannot think of a good name.

I'm also not hugely in favour of `ldexp` and `frexp` but the precedent from C is large. (e.g. AFAICT,  `ldexp` must mean "load exponent" which is essentially what it does... but only for a subset of its inputs.)
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/num/f32.rs138
-rw-r--r--src/libstd/num/f64.rs143
-rw-r--r--src/libstd/num/mod.rs218
-rw-r--r--src/libstd/num/uint_macros.rs2
4 files changed, 465 insertions, 36 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index f2a0419e391..0a1c17fab47 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -19,12 +19,14 @@ use prelude::v1::*;
 
 use intrinsics;
 use libc::c_int;
-use num::{Float, FloatMath};
+use num::{Float, FpCategory};
 use num::strconv;
 use num::strconv::ExponentFormat::{ExpNone, ExpDec};
 use num::strconv::SignificantDigits::{DigAll, DigMax, DigExact};
 use num::strconv::SignFormat::SignNeg;
 
+use core::num;
+
 pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
 pub use core::f32::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
 pub use core::f32::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
@@ -71,8 +73,120 @@ mod cmath {
     }
 }
 
-#[unstable = "trait is unstable"]
-impl FloatMath for f32 {
+#[stable]
+impl Float for f32 {
+    #[inline]
+    fn nan() -> f32 { num::Float::nan() }
+    #[inline]
+    fn infinity() -> f32 { num::Float::infinity() }
+    #[inline]
+    fn neg_infinity() -> f32 { num::Float::neg_infinity() }
+    #[inline]
+    fn zero() -> f32 { num::Float::zero() }
+    #[inline]
+    fn neg_zero() -> f32 { num::Float::neg_zero() }
+    #[inline]
+    fn one() -> f32 { num::Float::one() }
+
+    #[allow(deprecated)]
+    #[inline]
+    fn mantissa_digits(unused_self: Option<f32>) -> uint {
+        num::Float::mantissa_digits(unused_self)
+    }
+    #[allow(deprecated)]
+    #[inline]
+    fn digits(unused_self: Option<f32>) -> uint { num::Float::digits(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn epsilon() -> f32 { num::Float::epsilon() }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_exp(unused_self: Option<f32>) -> int { num::Float::min_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_exp(unused_self: Option<f32>) -> int { num::Float::max_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_10_exp(unused_self: Option<f32>) -> int { num::Float::min_10_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_10_exp(unused_self: Option<f32>) -> int { num::Float::max_10_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_value() -> f32 { num::Float::min_value() }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_pos_value(unused_self: Option<f32>) -> f32 { num::Float::min_pos_value(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_value() -> f32 { num::Float::max_value() }
+
+    #[inline]
+    fn is_nan(self) -> bool { num::Float::is_nan(self) }
+    #[inline]
+    fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
+    #[inline]
+    fn is_finite(self) -> bool { num::Float::is_finite(self) }
+    #[inline]
+    fn is_normal(self) -> bool { num::Float::is_normal(self) }
+    #[inline]
+    fn classify(self) -> FpCategory { num::Float::classify(self) }
+
+    #[inline]
+    fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
+
+    #[inline]
+    fn floor(self) -> f32 { num::Float::floor(self) }
+    #[inline]
+    fn ceil(self) -> f32 { num::Float::ceil(self) }
+    #[inline]
+    fn round(self) -> f32 { num::Float::round(self) }
+    #[inline]
+    fn trunc(self) -> f32 { num::Float::trunc(self) }
+    #[inline]
+    fn fract(self) -> f32 { num::Float::fract(self) }
+
+    #[inline]
+    fn abs(self) -> f32 { num::Float::abs(self) }
+    #[inline]
+    fn signum(self) -> f32 { num::Float::signum(self) }
+    #[inline]
+    fn is_positive(self) -> bool { num::Float::is_positive(self) }
+    #[inline]
+    fn is_negative(self) -> bool { num::Float::is_negative(self) }
+
+    #[inline]
+    fn mul_add(self, a: f32, b: f32) -> f32 { num::Float::mul_add(self, a, b) }
+    #[inline]
+    fn recip(self) -> f32 { num::Float::recip(self) }
+
+    #[inline]
+    fn powi(self, n: i32) -> f32 { num::Float::powi(self, n) }
+    #[inline]
+    fn powf(self, n: f32) -> f32 { num::Float::powf(self, n) }
+
+    #[inline]
+    fn sqrt(self) -> f32 { num::Float::sqrt(self) }
+    #[inline]
+    fn rsqrt(self) -> f32 { num::Float::rsqrt(self) }
+
+    #[inline]
+    fn exp(self) -> f32 { num::Float::exp(self) }
+    #[inline]
+    fn exp2(self) -> f32 { num::Float::exp(self) }
+    #[inline]
+    fn ln(self) -> f32 { num::Float::ln(self) }
+    #[inline]
+    fn log(self, base: f32) -> f32 { num::Float::log(self, base) }
+    #[inline]
+    fn log2(self) -> f32 { num::Float::log2(self) }
+    #[inline]
+    fn log10(self) -> f32 { num::Float::log10(self) }
+    #[inline]
+    fn to_degrees(self) -> f32 { num::Float::to_degrees(self) }
+    #[inline]
+    fn to_radians(self) -> f32 { num::Float::to_radians(self) }
+
     /// Constructs a floating point number by multiplying `x` by 2 raised to the
     /// power of `exp`
     #[inline]
@@ -639,18 +753,18 @@ mod tests {
         // are supported in floating-point literals
         let f1: f32 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
         let f2: f32 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
-        assert_eq!(FloatMath::ldexp(1f32, -123), f1);
-        assert_eq!(FloatMath::ldexp(1f32, -111), f2);
+        assert_eq!(Float::ldexp(1f32, -123), f1);
+        assert_eq!(Float::ldexp(1f32, -111), f2);
 
-        assert_eq!(FloatMath::ldexp(0f32, -123), 0f32);
-        assert_eq!(FloatMath::ldexp(-0f32, -123), -0f32);
+        assert_eq!(Float::ldexp(0f32, -123), 0f32);
+        assert_eq!(Float::ldexp(-0f32, -123), -0f32);
 
         let inf: f32 = Float::infinity();
         let neg_inf: f32 = Float::neg_infinity();
         let nan: f32 = Float::nan();
-        assert_eq!(FloatMath::ldexp(inf, -123), inf);
-        assert_eq!(FloatMath::ldexp(neg_inf, -123), neg_inf);
-        assert!(FloatMath::ldexp(nan, -123).is_nan());
+        assert_eq!(Float::ldexp(inf, -123), inf);
+        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
+        assert!(Float::ldexp(nan, -123).is_nan());
     }
 
     #[test]
@@ -663,8 +777,8 @@ mod tests {
         let (x2, exp2) = f2.frexp();
         assert_eq!((x1, exp1), (0.5f32, -122));
         assert_eq!((x2, exp2), (0.5f32, -110));
-        assert_eq!(FloatMath::ldexp(x1, exp1), f1);
-        assert_eq!(FloatMath::ldexp(x2, exp2), f2);
+        assert_eq!(Float::ldexp(x1, exp1), f1);
+        assert_eq!(Float::ldexp(x2, exp2), f2);
 
         assert_eq!(0f32.frexp(), (0f32, 0));
         assert_eq!((-0f32).frexp(), (-0f32, 0));
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 105a8a23bd1..2806154a016 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -18,12 +18,14 @@ use prelude::v1::*;
 
 use intrinsics;
 use libc::c_int;
-use num::{Float, FloatMath};
+use num::{Float, FpCategory};
 use num::strconv;
 use num::strconv::ExponentFormat::{ExpNone, ExpDec};
 use num::strconv::SignificantDigits::{DigAll, DigMax, DigExact};
 use num::strconv::SignFormat::SignNeg;
 
+use core::num;
+
 pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON, MIN_VALUE};
 pub use core::f64::{MIN_POS_VALUE, MAX_VALUE, MIN_EXP, MAX_EXP, MIN_10_EXP};
 pub use core::f64::{MAX_10_EXP, NAN, INFINITY, NEG_INFINITY};
@@ -79,10 +81,123 @@ mod cmath {
     }
 }
 
-#[unstable = "trait is unstable"]
-impl FloatMath for f64 {
-    /// Constructs a floating point number by multiplying `x` by 2 raised to the
-    /// power of `exp`
+#[stable]
+impl Float for f64 {
+    // inlined methods from `num::Float`
+    #[inline]
+    fn nan() -> f64 { num::Float::nan() }
+    #[inline]
+    fn infinity() -> f64 { num::Float::infinity() }
+    #[inline]
+    fn neg_infinity() -> f64 { num::Float::neg_infinity() }
+    #[inline]
+    fn zero() -> f64 { num::Float::zero() }
+    #[inline]
+    fn neg_zero() -> f64 { num::Float::neg_zero() }
+    #[inline]
+    fn one() -> f64 { num::Float::one() }
+
+
+    #[allow(deprecated)]
+    #[inline]
+    fn mantissa_digits(unused_self: Option<f64>) -> uint {
+        num::Float::mantissa_digits(unused_self)
+    }
+    #[allow(deprecated)]
+    #[inline]
+    fn digits(unused_self: Option<f64>) -> uint { num::Float::digits(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn epsilon() -> f64 { num::Float::epsilon() }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_exp(unused_self: Option<f64>) -> int { num::Float::min_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_exp(unused_self: Option<f64>) -> int { num::Float::max_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_10_exp(unused_self: Option<f64>) -> int { num::Float::min_10_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_10_exp(unused_self: Option<f64>) -> int { num::Float::max_10_exp(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_value() -> f64 { num::Float::min_value() }
+    #[allow(deprecated)]
+    #[inline]
+    fn min_pos_value(unused_self: Option<f64>) -> f64 { num::Float::min_pos_value(unused_self) }
+    #[allow(deprecated)]
+    #[inline]
+    fn max_value() -> f64 { num::Float::max_value() }
+
+    #[inline]
+    fn is_nan(self) -> bool { num::Float::is_nan(self) }
+    #[inline]
+    fn is_infinite(self) -> bool { num::Float::is_infinite(self) }
+    #[inline]
+    fn is_finite(self) -> bool { num::Float::is_finite(self) }
+    #[inline]
+    fn is_normal(self) -> bool { num::Float::is_normal(self) }
+    #[inline]
+    fn classify(self) -> FpCategory { num::Float::classify(self) }
+
+    #[inline]
+    fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) }
+
+    #[inline]
+    fn floor(self) -> f64 { num::Float::floor(self) }
+    #[inline]
+    fn ceil(self) -> f64 { num::Float::ceil(self) }
+    #[inline]
+    fn round(self) -> f64 { num::Float::round(self) }
+    #[inline]
+    fn trunc(self) -> f64 { num::Float::trunc(self) }
+    #[inline]
+    fn fract(self) -> f64 { num::Float::fract(self) }
+
+    #[inline]
+    fn abs(self) -> f64 { num::Float::abs(self) }
+    #[inline]
+    fn signum(self) -> f64 { num::Float::signum(self) }
+    #[inline]
+    fn is_positive(self) -> bool { num::Float::is_positive(self) }
+    #[inline]
+    fn is_negative(self) -> bool { num::Float::is_negative(self) }
+
+    #[inline]
+    fn mul_add(self, a: f64, b: f64) -> f64 { num::Float::mul_add(self, a, b) }
+    #[inline]
+    fn recip(self) -> f64 { num::Float::recip(self) }
+
+    #[inline]
+    fn powi(self, n: i32) -> f64 { num::Float::powi(self, n) }
+    #[inline]
+    fn powf(self, n: f64) -> f64 { num::Float::powf(self, n) }
+
+    #[inline]
+    fn sqrt(self) -> f64 { num::Float::sqrt(self) }
+    #[inline]
+    fn rsqrt(self) -> f64 { num::Float::rsqrt(self) }
+
+    #[inline]
+    fn exp(self) -> f64 { num::Float::exp(self) }
+    #[inline]
+    fn exp2(self) -> f64 { num::Float::exp(self) }
+    #[inline]
+    fn ln(self) -> f64 { num::Float::ln(self) }
+    #[inline]
+    fn log(self, base: f64) -> f64 { num::Float::log(self, base) }
+    #[inline]
+    fn log2(self) -> f64 { num::Float::log2(self) }
+    #[inline]
+    fn log10(self) -> f64 { num::Float::log10(self) }
+
+    #[inline]
+    fn to_degrees(self) -> f64 { num::Float::to_degrees(self) }
+    #[inline]
+    fn to_radians(self) -> f64 { num::Float::to_radians(self) }
+
     #[inline]
     fn ldexp(x: f64, exp: int) -> f64 {
         unsafe { cmath::ldexp(x, exp as c_int) }
@@ -640,18 +755,18 @@ mod tests {
         // are supported in floating-point literals
         let f1: f64 = FromStrRadix::from_str_radix("1p-123", 16).unwrap();
         let f2: f64 = FromStrRadix::from_str_radix("1p-111", 16).unwrap();
-        assert_eq!(FloatMath::ldexp(1f64, -123), f1);
-        assert_eq!(FloatMath::ldexp(1f64, -111), f2);
+        assert_eq!(Float::ldexp(1f64, -123), f1);
+        assert_eq!(Float::ldexp(1f64, -111), f2);
 
-        assert_eq!(FloatMath::ldexp(0f64, -123), 0f64);
-        assert_eq!(FloatMath::ldexp(-0f64, -123), -0f64);
+        assert_eq!(Float::ldexp(0f64, -123), 0f64);
+        assert_eq!(Float::ldexp(-0f64, -123), -0f64);
 
         let inf: f64 = Float::infinity();
         let neg_inf: f64 = Float::neg_infinity();
         let nan: f64 = Float::nan();
-        assert_eq!(FloatMath::ldexp(inf, -123), inf);
-        assert_eq!(FloatMath::ldexp(neg_inf, -123), neg_inf);
-        assert!(FloatMath::ldexp(nan, -123).is_nan());
+        assert_eq!(Float::ldexp(inf, -123), inf);
+        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
+        assert!(Float::ldexp(nan, -123).is_nan());
     }
 
     #[test]
@@ -664,8 +779,8 @@ mod tests {
         let (x2, exp2) = f2.frexp();
         assert_eq!((x1, exp1), (0.5f64, -122));
         assert_eq!((x2, exp2), (0.5f64, -110));
-        assert_eq!(FloatMath::ldexp(x1, exp1), f1);
-        assert_eq!(FloatMath::ldexp(x2, exp2), f2);
+        assert_eq!(Float::ldexp(x1, exp1), f1);
+        assert_eq!(Float::ldexp(x2, exp2), f2);
 
         assert_eq!(0f64.frexp(), (0f64, 0));
         assert_eq!((-0f64).frexp(), (-0f64, 0));
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index c126eb1d6cf..e3402984ae5 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -16,10 +16,12 @@
 #![stable]
 #![allow(missing_docs)]
 
-#[cfg(test)] use cmp::PartialEq;
 #[cfg(test)] use fmt::Show;
-#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
-#[cfg(test)] use kinds::Copy;
+use ops::{Add, Sub, Mul, Div, Rem, Neg};
+
+use kinds::Copy;
+use clone::Clone;
+use cmp::{PartialOrd, PartialEq};
 
 pub use core::num::{Int, SignedInt, UnsignedInt};
 pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
@@ -27,16 +29,195 @@ pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
 pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
 pub use core::num::{from_f32, from_f64};
 pub use core::num::{FromStrRadix, from_str_radix};
-pub use core::num::{FpCategory, Float};
+pub use core::num::{FpCategory};
+
+use option::Option;
 
 #[experimental = "may be removed or relocated"]
 pub mod strconv;
 
 /// Mathematical operations on primitive floating point numbers.
-#[unstable = "may be altered to inline the Float trait"]
-pub trait FloatMath: Float {
+#[stable]
+pub trait Float
+    : Copy + Clone
+    + NumCast
+    + PartialOrd
+    + PartialEq
+    + Neg<Output=Self>
+    + Add<Output=Self>
+    + Sub<Output=Self>
+    + Mul<Output=Self>
+    + Div<Output=Self>
+    + Rem<Output=Self>
+{
+    // inlined methods from `num::Float`
+    /// Returns the NaN value.
+    #[unstable = "unsure about its place in the world"]
+    fn nan() -> Self;
+    /// Returns the infinite value.
+    #[unstable = "unsure about its place in the world"]
+    fn infinity() -> Self;
+    /// Returns the negative infinite value.
+    #[unstable = "unsure about its place in the world"]
+    fn neg_infinity() -> Self;
+    /// Returns the `0` value.
+    #[unstable = "unsure about its place in the world"]
+    fn zero() -> Self;
+    /// Returns -0.0.
+    #[unstable = "unsure about its place in the world"]
+    fn neg_zero() -> Self;
+    /// Returns the `1` value.
+    #[unstable = "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"]
+    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"]
+    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"]
+    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"]
+    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"]
+    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"]
+    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"]
+    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"]
+    fn min_value() -> Self;
+    /// Returns the smallest normalized positive number that this type can represent.
+    #[unstable = "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"]
+    fn max_value() -> Self;
+
+    /// Returns true if this value is NaN and false otherwise.
+    #[unstable = "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"]
+    fn is_infinite(self) -> bool;
+    /// Returns true if this number is neither infinite nor NaN.
+    #[unstable = "position is undecided"]
+    fn is_finite(self) -> bool;
+    /// Returns true if this number is neither zero, infinite, denormal, or NaN.
+    #[unstable = "position is undecided"]
+    fn is_normal(self) -> bool;
+    /// Returns the category that this number falls into.
+    #[stable]
+    fn classify(self) -> FpCategory;
+
+    /// Returns the mantissa, exponent and sign as integers, respectively.
+    #[unstable = "signature is undecided"]
+    fn integer_decode(self) -> (u64, i16, i8);
+
+    /// Return the largest integer less than or equal to a number.
+    #[stable]
+    fn floor(self) -> Self;
+    /// Return the smallest integer greater than or equal to a number.
+    #[stable]
+    fn ceil(self) -> Self;
+    /// Return the nearest integer to a number. Round half-way cases away from
+    /// `0.0`.
+    #[stable]
+    fn round(self) -> Self;
+    /// Return the integer part of a number.
+    #[stable]
+    fn trunc(self) -> Self;
+    /// Return the fractional part of a number.
+    #[stable]
+    fn fract(self) -> Self;
+
+    /// Computes the absolute value of `self`. Returns `Float::nan()` if the
+    /// number is `Float::nan()`.
+    #[stable]
+    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]
+    fn signum(self) -> Self;
+    /// Returns `true` if `self` is positive, including `+0.0` and
+    /// `Float::infinity()`.
+    #[stable]
+    fn is_positive(self) -> bool;
+    /// Returns `true` if `self` is negative, including `-0.0` and
+    /// `Float::neg_infinity()`.
+    #[stable]
+    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"]
+    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"]
+    fn recip(self) -> Self;
+
+    /// Raise a number to an integer power.
+    ///
+    /// Using this function is generally faster than using `powf`
+    #[stable]
+    fn powi(self, n: i32) -> Self;
+    /// Raise a number to a floating point power.
+    #[stable]
+    fn powf(self, n: Self) -> Self;
+
+    /// Take the square root of a number.
+    ///
+    /// Returns NaN if `self` is a negative number.
+    #[stable]
+    fn sqrt(self) -> Self;
+    /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
+    #[unstable = "unsure about its place in the world"]
+    fn rsqrt(self) -> Self;
+
+    /// Returns `e^(self)`, (the exponential function).
+    #[stable]
+    fn exp(self) -> Self;
+    /// Returns 2 raised to the power of the number, `2^(self)`.
+    #[stable]
+    fn exp2(self) -> Self;
+    /// Returns the natural logarithm of the number.
+    #[stable]
+    fn ln(self) -> Self;
+    /// Returns the logarithm of the number with respect to an arbitrary base.
+    #[stable]
+    fn log(self, base: Self) -> Self;
+    /// Returns the base 2 logarithm of the number.
+    #[stable]
+    fn log2(self) -> Self;
+    /// Returns the base 10 logarithm of the number.
+    #[stable]
+    fn log10(self) -> Self;
+
+    /// Convert radians to degrees.
+    #[unstable = "desirability is unclear"]
+    fn to_degrees(self) -> Self;
+    /// Convert degrees to radians.
+    #[unstable = "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"]
     fn ldexp(x: Self, exp: int) -> Self;
     /// Breaks the number into a normalized fraction and a base-2 exponent,
     /// satisfying:
@@ -44,76 +225,97 @@ pub trait FloatMath: Float {
     ///  * `self = x * pow(2, exp)`
     ///
     ///  * `0.5 <= abs(x) < 1.0`
+    #[unstable = "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"]
     fn next_after(self, other: Self) -> Self;
 
     /// Returns the maximum of the two numbers.
+    #[stable]
     fn max(self, other: Self) -> Self;
     /// Returns the minimum of the two numbers.
+    #[stable]
     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"]
     fn abs_sub(self, other: Self) -> Self;
 
     /// Take the cubic root of a number.
+    #[unstable = "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"]
     fn hypot(self, other: Self) -> Self;
 
     /// Computes the sine of a number (in radians).
+    #[stable]
     fn sin(self) -> Self;
     /// Computes the cosine of a number (in radians).
+    #[stable]
     fn cos(self) -> Self;
     /// Computes the tangent of a number (in radians).
+    #[stable]
     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]
     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]
     fn acos(self) -> Self;
     /// Computes the arctangent of a number. Return value is in radians in the
     /// range [-pi/2, pi/2];
+    #[stable]
     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]
     fn atan2(self, other: Self) -> Self;
     /// Simultaneously computes the sine and cosine of the number, `x`. Returns
     /// `(sin(x), cos(x))`.
+    #[stable]
     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"]
     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"]
     fn ln_1p(self) -> Self;
 
     /// Hyperbolic sine function.
+    #[stable]
     fn sinh(self) -> Self;
     /// Hyperbolic cosine function.
+    #[stable]
     fn cosh(self) -> Self;
     /// Hyperbolic tangent function.
+    #[stable]
     fn tanh(self) -> Self;
     /// Inverse hyperbolic sine function.
+    #[stable]
     fn asinh(self) -> Self;
     /// Inverse hyperbolic cosine function.
+    #[stable]
     fn acosh(self) -> Self;
     /// Inverse hyperbolic tangent function.
+    #[stable]
     fn atanh(self) -> Self;
 }
 
-// DEPRECATED
-
 /// Helper function for testing numeric operations
 #[cfg(test)]
 pub fn test_num<T>(ten: T, two: T) where
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 08ea1b024c9..4ce15491a0e 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -14,8 +14,6 @@
 
 macro_rules! uint_module { ($T:ty) => (
 
-// String conversion functions and impl num -> str
-
 #[cfg(test)]
 mod tests {
     use prelude::v1::*;