about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-17 23:45:55 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-21 15:23:54 -0700
commita568a7f9f2eb3fa3f3e049df288ef0ad32cc7881 (patch)
tree2d96b295e43de338e7e650110ba00ac2e116b519
parent0791f9f406053d84dc7136c2be015a469304d7f0 (diff)
downloadrust-a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881.tar.gz
rust-a568a7f9f2eb3fa3f3e049df288ef0ad32cc7881.zip
std: Bring back f32::from_str_radix as an unstable API
This API was exercised in a few tests and mirrors the `from_str_radix`
functionality of the integer types.
-rw-r--r--src/doc/trpl/traits.md2
-rw-r--r--src/libcollections/bit.rs1
-rw-r--r--src/libcollections/fmt.rs8
-rw-r--r--src/libcore/iter.rs3
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/libcore/num/f32.rs9
-rw-r--r--src/libcore/num/f64.rs9
-rw-r--r--src/libcore/num/float_macros.rs142
-rw-r--r--src/libcore/num/mod.rs250
-rw-r--r--src/libcoretest/cmp.rs2
-rw-r--r--src/libcoretest/iter.rs11
-rw-r--r--src/libcoretest/lib.rs6
-rw-r--r--src/libcoretest/num/int_macros.rs67
-rw-r--r--src/libcoretest/num/mod.rs31
-rw-r--r--src/libcoretest/num/uint_macros.rs27
-rw-r--r--src/librand/distributions/range.rs1
-rw-r--r--src/librustc_back/sha2.rs4
-rw-r--r--src/libstd/collections/hash/map.rs4
-rw-r--r--src/libstd/env.rs6
-rw-r--r--src/libstd/lib.rs1
-rw-r--r--src/libstd/num/f32.rs230
-rw-r--r--src/libstd/num/f64.rs242
-rw-r--r--src/libstd/num/mod.rs552
-rw-r--r--src/libstd/num/uint_macros.rs21
-rw-r--r--src/libstd/rand/reader.rs13
-rw-r--r--src/libstd/sys/windows/fs2.rs2
-rw-r--r--src/libstd/sys/windows/mod.rs8
-rw-r--r--src/libstd/sys/windows/net.rs15
-rw-r--r--src/libstd/sys/windows/process2.rs4
-rw-r--r--src/libtest/stats.rs3
-rw-r--r--src/test/bench/noise.rs1
-rw-r--r--src/test/bench/shootout-binarytrees.rs3
-rw-r--r--src/test/bench/shootout-fasta.rs1
-rw-r--r--src/test/bench/shootout-nbody.rs21
-rw-r--r--src/test/bench/shootout-spectralnorm.rs1
-rw-r--r--src/test/bench/sudoku.rs1
-rw-r--r--src/test/pretty/default-trait-impl.rs6
37 files changed, 561 insertions, 1148 deletions
diff --git a/src/doc/trpl/traits.md b/src/doc/trpl/traits.md
index 7330e42ccf6..3e77d3c603b 100644
--- a/src/doc/trpl/traits.md
+++ b/src/doc/trpl/traits.md
@@ -336,7 +336,7 @@ This shows off the additional feature of `where` clauses: they allow bounds
 where the left-hand side is an arbitrary type (`i32` in this case), not just a
 plain type parameter (like `T`).
 
-# Default methods
+## Default methods
 
 There’s one last feature of traits we should cover: default methods. It’s
 easiest just to show an example:
diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs
index d12b979e084..bb90363bc1d 100644
--- a/src/libcollections/bit.rs
+++ b/src/libcollections/bit.rs
@@ -40,7 +40,6 @@
 //! ```
 //! # #![feature(collections, core, step_by)]
 //! use std::collections::{BitSet, BitVec};
-//! use std::num::Float;
 //! use std::iter;
 //!
 //! let max_prime = 10000;
diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs
index 80942754c7b..d8a0e4daf43 100644
--- a/src/libcollections/fmt.rs
+++ b/src/libcollections/fmt.rs
@@ -175,7 +175,6 @@
 //! # #![feature(core, std_misc)]
 //! use std::fmt;
 //! use std::f64;
-//! use std::num::Float;
 //!
 //! #[derive(Debug)]
 //! struct Vector2D {
@@ -200,10 +199,11 @@
 //!         let magnitude = magnitude.sqrt();
 //!
 //!         // Respect the formatting flags by using the helper method
-//!         // `pad_integral` on the Formatter object. See the method documentation
-//!         // for details, and the function `pad` can be used to pad strings.
+//!         // `pad_integral` on the Formatter object. See the method
+//!         // documentation for details, and the function `pad` can be used
+//!         // to pad strings.
 //!         let decimals = f.precision().unwrap_or(3);
-//!         let string = f64::to_str_exact(magnitude, decimals);
+//!         let string = format!("{:.*}", decimals, magnitude);
 //!         f.pad_integral(true, "", &string)
 //!     }
 //! }
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs
index 651658e4d56..233ed018119 100644
--- a/src/libcore/iter.rs
+++ b/src/libcore/iter.rs
@@ -2327,9 +2327,8 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
 /// An iterator that yields sequential Fibonacci numbers, and stops on overflow.
 ///
 /// ```
-/// # #![feature(core)]
+/// #![feature(core)]
 /// use std::iter::Unfold;
-/// use std::num::Int; // For `.checked_add()`
 ///
 /// // This iterator will yield up to the last Fibonacci number before the max
 /// // value of `u32`. You can simply change `u32` to `u64` in this line if
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 164d3e49385..249f0a0c389 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -108,6 +108,7 @@ mod uint_macros;
 #[path = "num/f32.rs"]   pub mod f32;
 #[path = "num/f64.rs"]   pub mod f64;
 
+#[macro_use]
 pub mod num;
 
 /* The libcore prelude, not as all-encompassing as the libstd prelude */
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index a9afa5078d2..50dd3f1661a 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -16,9 +16,11 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
+use prelude::*;
+
 use intrinsics;
 use mem;
-use num::Float;
+use num::{Float, ParseFloatError};
 use num::FpCategory as Fp;
 
 #[stable(feature = "rust1", since = "1.0.0")]
@@ -153,6 +155,8 @@ impl Float for f32 {
     #[inline]
     fn one() -> f32 { 1.0 }
 
+    from_str_radix_float_impl! { f32 }
+
     /// Returns `true` if the number is NaN.
     #[inline]
     fn is_nan(self) -> bool { self != self }
@@ -234,9 +238,6 @@ impl Float for f32 {
     /// The fractional part of the number, satisfying:
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    ///
     /// let x = 1.65f32;
     /// assert!(x == x.trunc() + x.fract())
     /// ```
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index fa9660a60e9..62b566e7eb4 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -16,10 +16,12 @@
 
 #![stable(feature = "rust1", since = "1.0.0")]
 
+use prelude::*;
+
 use intrinsics;
 use mem;
-use num::Float;
 use num::FpCategory as Fp;
+use num::{Float, ParseFloatError};
 
 #[stable(feature = "rust1", since = "1.0.0")]
 pub const RADIX: u32 = 2;
@@ -153,6 +155,8 @@ impl Float for f64 {
     #[inline]
     fn one() -> f64 { 1.0 }
 
+    from_str_radix_float_impl! { f64 }
+
     /// Returns `true` if the number is NaN.
     #[inline]
     fn is_nan(self) -> bool { self != self }
@@ -234,9 +238,6 @@ impl Float for f64 {
     /// The fractional part of the number, satisfying:
     ///
     /// ```
-    /// # #![feature(core)]
-    /// use std::num::Float;
-    ///
     /// let x = 1.65f64;
     /// assert!(x == x.trunc() + x.fract())
     /// ```
diff --git a/src/libcore/num/float_macros.rs b/src/libcore/num/float_macros.rs
index b3adef53dab..5ee0dc19f9b 100644
--- a/src/libcore/num/float_macros.rs
+++ b/src/libcore/num/float_macros.rs
@@ -18,3 +18,145 @@ macro_rules! assert_approx_eq {
                 "{} is not approximately equal to {}", *a, *b);
     })
 }
+
+macro_rules! from_str_radix_float_impl {
+    ($T:ty) => {
+        fn from_str_radix(src: &str, radix: u32)
+                          -> Result<$T, ParseFloatError> {
+            use num::FloatErrorKind::*;
+            use num::ParseFloatError as PFE;
+
+            // Special values
+            match src {
+                "inf"   => return Ok(Float::infinity()),
+                "-inf"  => return Ok(Float::neg_infinity()),
+                "NaN"   => return Ok(Float::nan()),
+                _       => {},
+            }
+
+            let (is_positive, src) =  match src.slice_shift_char() {
+                None             => return Err(PFE { kind: Empty }),
+                Some(('-', ""))  => return Err(PFE { kind: Empty }),
+                Some(('-', src)) => (false, src),
+                Some((_, _))     => (true,  src),
+            };
+
+            // The significand to accumulate
+            let mut sig = if is_positive { 0.0 } else { -0.0 };
+            // Necessary to detect overflow
+            let mut prev_sig = sig;
+            let mut cs = src.chars().enumerate();
+            // Exponent prefix and exponent index offset
+            let mut exp_info = None::<(char, usize)>;
+
+            // Parse the integer part of the significand
+            for (i, c) in cs.by_ref() {
+                match c.to_digit(radix) {
+                    Some(digit) => {
+                        // shift significand one digit left
+                        sig = sig * (radix as $T);
+
+                        // add/subtract current digit depending on sign
+                        if is_positive {
+                            sig = sig + ((digit as isize) as $T);
+                        } else {
+                            sig = sig - ((digit as isize) as $T);
+                        }
+
+                        // Detect overflow by comparing to last value, except
+                        // if we've not seen any non-zero digits.
+                        if prev_sig != 0.0 {
+                            if is_positive && sig <= prev_sig
+                                { return Ok(Float::infinity()); }
+                            if !is_positive && sig >= prev_sig
+                                { return Ok(Float::neg_infinity()); }
+
+                            // Detect overflow by reversing the shift-and-add process
+                            if is_positive && (prev_sig != (sig - digit as $T) / radix as $T)
+                                { return Ok(Float::infinity()); }
+                            if !is_positive && (prev_sig != (sig + digit as $T) / radix as $T)
+                                { return Ok(Float::neg_infinity()); }
+                        }
+                        prev_sig = sig;
+                    },
+                    None => match c {
+                        'e' | 'E' | 'p' | 'P' => {
+                            exp_info = Some((c, i + 1));
+                            break;  // start of exponent
+                        },
+                        '.' => {
+                            break;  // start of fractional part
+                        },
+                        _ => {
+                            return Err(PFE { kind: Invalid });
+                        },
+                    },
+                }
+            }
+
+            // If we are not yet at the exponent parse the fractional
+            // part of the significand
+            if exp_info.is_none() {
+                let mut power = 1.0;
+                for (i, c) in cs.by_ref() {
+                    match c.to_digit(radix) {
+                        Some(digit) => {
+                            // Decrease power one order of magnitude
+                            power = power / (radix as $T);
+                            // add/subtract current digit depending on sign
+                            sig = if is_positive {
+                                sig + (digit as $T) * power
+                            } else {
+                                sig - (digit as $T) * power
+                            };
+                            // Detect overflow by comparing to last value
+                            if is_positive && sig < prev_sig
+                                { return Ok(Float::infinity()); }
+                            if !is_positive && sig > prev_sig
+                                { return Ok(Float::neg_infinity()); }
+                            prev_sig = sig;
+                        },
+                        None => match c {
+                            'e' | 'E' | 'p' | 'P' => {
+                                exp_info = Some((c, i + 1));
+                                break; // start of exponent
+                            },
+                            _ => {
+                                return Err(PFE { kind: Invalid });
+                            },
+                        },
+                    }
+                }
+            }
+
+            // Parse and calculate the exponent
+            let exp = match exp_info {
+                Some((c, offset)) => {
+                    let base = match c {
+                        'E' | 'e' if radix == 10 => 10.0,
+                        'P' | 'p' if radix == 16 => 2.0,
+                        _ => return Err(PFE { kind: Invalid }),
+                    };
+
+                    // Parse the exponent as decimal integer
+                    let src = &src[offset..];
+                    let (is_positive, exp) = match src.slice_shift_char() {
+                        Some(('-', src)) => (false, src.parse::<usize>()),
+                        Some(('+', src)) => (true,  src.parse::<usize>()),
+                        Some((_, _))     => (true,  src.parse::<usize>()),
+                        None             => return Err(PFE { kind: Invalid }),
+                    };
+
+                    match (is_positive, exp) {
+                        (true,  Ok(exp)) => base.powi(exp as i32),
+                        (false, Ok(exp)) => 1.0 / base.powi(exp as i32),
+                        (_, Err(_))      => return Err(PFE { kind: Invalid }),
+                    }
+                },
+                None => 1.0, // no exponent
+            };
+
+            Ok(sig * exp)
+        }
+    }
+}
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index cd1ce1f4535..44d5333ce1f 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -19,7 +19,6 @@ use char::CharExt;
 use cmp::{Eq, PartialOrd};
 use fmt;
 use intrinsics;
-use iter::Iterator;
 use marker::Copy;
 use mem::size_of;
 use option::Option::{self, Some, None};
@@ -148,9 +147,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b01001100u8;
         ///
         /// assert_eq!(n.count_ones(), 3);
@@ -164,9 +160,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b01001100u8;
         ///
         /// assert_eq!(n.count_zeros(), 5);
@@ -183,9 +176,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b0101000u16;
         ///
         /// assert_eq!(n.leading_zeros(), 10);
@@ -202,9 +192,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b0101000u16;
         ///
         /// assert_eq!(n.trailing_zeros(), 3);
@@ -221,9 +208,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0x3456789ABCDEF012u64;
         ///
@@ -242,9 +226,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0xDEF0123456789ABCu64;
         ///
@@ -261,8 +242,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0xEFCDAB8967452301u64;
         ///
@@ -282,14 +261,12 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(Int::from_be(n), n)
+        ///     assert_eq!(u64::from_be(n), n)
         /// } else {
-        ///     assert_eq!(Int::from_be(n), n.swap_bytes())
+        ///     assert_eq!(u64::from_be(n), n.swap_bytes())
         /// }
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
@@ -306,14 +283,12 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(Int::from_le(n), n)
+        ///     assert_eq!(u64::from_le(n), n)
         /// } else {
-        ///     assert_eq!(Int::from_le(n), n.swap_bytes())
+        ///     assert_eq!(u64::from_le(n), n.swap_bytes())
         /// }
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
@@ -330,8 +305,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "big") {
@@ -354,8 +327,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "little") {
@@ -376,8 +347,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!(5u16.checked_add(65530), Some(65535));
         /// assert_eq!(6u16.checked_add(65530), None);
         /// ```
@@ -393,8 +362,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!((-127i8).checked_sub(1), Some(-128));
         /// assert_eq!((-128i8).checked_sub(1), None);
         /// ```
@@ -410,8 +377,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!(5u8.checked_mul(51), Some(255));
         /// assert_eq!(5u8.checked_mul(52), None);
         /// ```
@@ -427,8 +392,6 @@ macro_rules! int_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!((-127i8).checked_div(-1), Some(127));
         /// assert_eq!((-128i8).checked_div(-1), None);
         /// assert_eq!((1i8).checked_div(0), None);
@@ -728,9 +691,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b01001100u8;
         ///
         /// assert_eq!(n.count_ones(), 3);
@@ -746,9 +706,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b01001100u8;
         ///
         /// assert_eq!(n.count_zeros(), 5);
@@ -765,9 +722,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b0101000u16;
         ///
         /// assert_eq!(n.leading_zeros(), 10);
@@ -784,9 +738,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0b0101000u16;
         ///
         /// assert_eq!(n.trailing_zeros(), 3);
@@ -803,9 +754,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0x3456789ABCDEF012u64;
         ///
@@ -826,9 +774,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0xDEF0123456789ABCu64;
         ///
@@ -847,8 +792,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         /// let m = 0xEFCDAB8967452301u64;
         ///
@@ -868,14 +811,12 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "big") {
-        ///     assert_eq!(Int::from_be(n), n)
+        ///     assert_eq!(u64::from_be(n), n)
         /// } else {
-        ///     assert_eq!(Int::from_be(n), n.swap_bytes())
+        ///     assert_eq!(u64::from_be(n), n.swap_bytes())
         /// }
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
@@ -892,14 +833,12 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "little") {
-        ///     assert_eq!(Int::from_le(n), n)
+        ///     assert_eq!(u64::from_le(n), n)
         /// } else {
-        ///     assert_eq!(Int::from_le(n), n.swap_bytes())
+        ///     assert_eq!(u64::from_le(n), n.swap_bytes())
         /// }
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
@@ -916,8 +855,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "big") {
@@ -940,8 +877,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// let n = 0x0123456789ABCDEFu64;
         ///
         /// if cfg!(target_endian = "little") {
@@ -962,8 +897,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!(5u16.checked_add(65530), Some(65535));
         /// assert_eq!(6u16.checked_add(65530), None);
         /// ```
@@ -979,8 +912,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!((-127i8).checked_sub(1), Some(-128));
         /// assert_eq!((-128i8).checked_sub(1), None);
         /// ```
@@ -996,8 +927,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!(5u8.checked_mul(51), Some(255));
         /// assert_eq!(5u8.checked_mul(52), None);
         /// ```
@@ -1013,8 +942,6 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// use std::num::Int;
-        ///
         /// assert_eq!((-127i8).checked_div(-1), Some(127));
         /// assert_eq!((-128i8).checked_div(-1), None);
         /// assert_eq!((1i8).checked_div(0), None);
@@ -1147,10 +1074,7 @@ macro_rules! uint_impl {
         /// # Examples
         ///
         /// ```rust
-        /// # #![feature(core)]
-        /// use std::num::Int;
-        ///
-        /// assert_eq!(2.pow(4), 16);
+        /// assert_eq!(2i32.pow(4), 16);
         /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[inline]
@@ -1328,6 +1252,8 @@ pub trait Float {
     fn zero() -> Self;
     /// Returns 1.0.
     fn one() -> Self;
+    /// Parses the string `s` with the radix `r` as a float.
+    fn from_str_radix(s: &str, r: u32) -> Result<Self, ParseFloatError>;
 
     /// Returns true if this value is NaN and false otherwise.
     fn is_nan(self) -> bool;
@@ -1412,8 +1338,8 @@ pub trait Float {
     fn to_radians(self) -> Self;
 }
 
-macro_rules! from_str_radix_float_impl {
-    ($T:ty) => {
+macro_rules! from_str_float_impl {
+    ($T:ident) => {
         #[stable(feature = "rust1", since = "1.0.0")]
         impl FromStr for $T {
             type Err = ParseFloatError;
@@ -1441,152 +1367,19 @@ macro_rules! from_str_radix_float_impl {
             ///
             /// # Return value
             ///
-            /// `Err(ParseFloatError)` if the string did not represent a valid number.
-            /// Otherwise, `Ok(n)` where `n` is the floating-point number represented by `src`.
+            /// `Err(ParseFloatError)` if the string did not represent a valid
+            /// number.  Otherwise, `Ok(n)` where `n` is the floating-point
+            /// number represented by `src`.
             #[inline]
             #[allow(deprecated)]
             fn from_str(src: &str) -> Result<$T, ParseFloatError> {
-                use self::FloatErrorKind::*;
-                use self::ParseFloatError as PFE;
-                let radix = 10;
-
-                // Special values
-                match src {
-                    "inf"   => return Ok(Float::infinity()),
-                    "-inf"  => return Ok(Float::neg_infinity()),
-                    "NaN"   => return Ok(Float::nan()),
-                    _       => {},
-                }
-
-                let (is_positive, src) =  match src.slice_shift_char() {
-                    None             => return Err(PFE { kind: Empty }),
-                    Some(('-', ""))  => return Err(PFE { kind: Empty }),
-                    Some(('-', src)) => (false, src),
-                    Some((_, _))     => (true,  src),
-                };
-
-                // The significand to accumulate
-                let mut sig = if is_positive { 0.0 } else { -0.0 };
-                // Necessary to detect overflow
-                let mut prev_sig = sig;
-                let mut cs = src.chars().enumerate();
-                // Exponent prefix and exponent index offset
-                let mut exp_info = None::<(char, usize)>;
-
-                // Parse the integer part of the significand
-                for (i, c) in cs.by_ref() {
-                    match c.to_digit(radix) {
-                        Some(digit) => {
-                            // shift significand one digit left
-                            sig = sig * (radix as $T);
-
-                            // add/subtract current digit depending on sign
-                            if is_positive {
-                                sig = sig + ((digit as isize) as $T);
-                            } else {
-                                sig = sig - ((digit as isize) as $T);
-                            }
-
-                            // Detect overflow by comparing to last value, except
-                            // if we've not seen any non-zero digits.
-                            if prev_sig != 0.0 {
-                                if is_positive && sig <= prev_sig
-                                    { return Ok(Float::infinity()); }
-                                if !is_positive && sig >= prev_sig
-                                    { return Ok(Float::neg_infinity()); }
-
-                                // Detect overflow by reversing the shift-and-add process
-                                if is_positive && (prev_sig != (sig - digit as $T) / radix as $T)
-                                    { return Ok(Float::infinity()); }
-                                if !is_positive && (prev_sig != (sig + digit as $T) / radix as $T)
-                                    { return Ok(Float::neg_infinity()); }
-                            }
-                            prev_sig = sig;
-                        },
-                        None => match c {
-                            'e' | 'E' | 'p' | 'P' => {
-                                exp_info = Some((c, i + 1));
-                                break;  // start of exponent
-                            },
-                            '.' => {
-                                break;  // start of fractional part
-                            },
-                            _ => {
-                                return Err(PFE { kind: Invalid });
-                            },
-                        },
-                    }
-                }
-
-                // If we are not yet at the exponent parse the fractional
-                // part of the significand
-                if exp_info.is_none() {
-                    let mut power = 1.0;
-                    for (i, c) in cs.by_ref() {
-                        match c.to_digit(radix) {
-                            Some(digit) => {
-                                // Decrease power one order of magnitude
-                                power = power / (radix as $T);
-                                // add/subtract current digit depending on sign
-                                sig = if is_positive {
-                                    sig + (digit as $T) * power
-                                } else {
-                                    sig - (digit as $T) * power
-                                };
-                                // Detect overflow by comparing to last value
-                                if is_positive && sig < prev_sig
-                                    { return Ok(Float::infinity()); }
-                                if !is_positive && sig > prev_sig
-                                    { return Ok(Float::neg_infinity()); }
-                                prev_sig = sig;
-                            },
-                            None => match c {
-                                'e' | 'E' | 'p' | 'P' => {
-                                    exp_info = Some((c, i + 1));
-                                    break; // start of exponent
-                                },
-                                _ => {
-                                    return Err(PFE { kind: Invalid });
-                                },
-                            },
-                        }
-                    }
-                }
-
-                // Parse and calculate the exponent
-                let exp = match exp_info {
-                    Some((c, offset)) => {
-                        let base = match c {
-                            'E' | 'e' if radix == 10 => 10.0,
-                            'P' | 'p' if radix == 16 => 2.0,
-                            _ => return Err(PFE { kind: Invalid }),
-                        };
-
-                        // Parse the exponent as decimal integer
-                        let src = &src[offset..];
-                        let (is_positive, exp) = match src.slice_shift_char() {
-                            Some(('-', src)) => (false, src.parse::<usize>()),
-                            Some(('+', src)) => (true,  src.parse::<usize>()),
-                            Some((_, _))     => (true,  src.parse::<usize>()),
-                            None             => return Err(PFE { kind: Invalid }),
-                        };
-
-                        match (is_positive, exp) {
-                            (true,  Ok(exp)) => base.powi(exp as i32),
-                            (false, Ok(exp)) => 1.0 / base.powi(exp as i32),
-                            (_, Err(_))      => return Err(PFE { kind: Invalid }),
-                        }
-                    },
-                    None => 1.0, // no exponent
-                };
-
-                Ok(sig * exp)
+                $T::from_str_radix(src, 10)
             }
         }
     }
 }
-from_str_radix_float_impl! { f32 }
-from_str_radix_float_impl! { f64 }
+from_str_float_impl!(f32);
+from_str_float_impl!(f64);
 
 macro_rules! from_str_radix_int_impl {
     ($($T:ident)*) => {$(
@@ -1716,11 +1509,10 @@ impl fmt::Display for ParseIntError {
 
 /// An error which can be returned when parsing a float.
 #[derive(Debug, Clone, PartialEq)]
-#[stable(feature = "rust1", since = "1.0.0")]
-pub struct ParseFloatError { kind: FloatErrorKind }
+pub struct ParseFloatError { pub kind: FloatErrorKind }
 
 #[derive(Debug, Clone, PartialEq)]
-enum FloatErrorKind {
+pub enum FloatErrorKind {
     Empty,
     Invalid,
 }
diff --git a/src/libcoretest/cmp.rs b/src/libcoretest/cmp.rs
index 9ed1508c3eb..e0d396c68b4 100644
--- a/src/libcoretest/cmp.rs
+++ b/src/libcoretest/cmp.rs
@@ -110,8 +110,6 @@ fn test_partial_max() {
 
 #[test]
 fn test_user_defined_eq() {
-    use core::num::SignedInt;
-
     // Our type.
     struct SketchyNum {
         num : isize
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs
index a56820c61cc..2866c193c3b 100644
--- a/src/libcoretest/iter.rs
+++ b/src/libcoretest/iter.rs
@@ -11,7 +11,6 @@
 use core::iter::*;
 use core::iter::order::*;
 use core::iter::MinMaxResult::*;
-use core::num::SignedInt;
 use core::usize;
 use core::cmp;
 
@@ -784,16 +783,6 @@ fn test_range_step() {
 }
 
 #[test]
-fn test_range_step_inclusive() {
-    assert_eq!(range_step_inclusive(0, 20, 5).collect::<Vec<isize>>(), [0, 5, 10, 15, 20]);
-    assert_eq!(range_step_inclusive(20, 0, -5).collect::<Vec<isize>>(), [20, 15, 10, 5, 0]);
-    assert_eq!(range_step_inclusive(20, 0, -6).collect::<Vec<isize>>(), [20, 14, 8, 2]);
-    assert_eq!(range_step_inclusive(200, 255, 50).collect::<Vec<u8>>(), [200, 250]);
-    assert_eq!(range_step_inclusive(200, -5, 1).collect::<Vec<isize>>(), []);
-    assert_eq!(range_step_inclusive(200, 200, 1).collect::<Vec<isize>>(), [200]);
-}
-
-#[test]
 fn test_reverse() {
     let mut ys = [1, 2, 3, 4, 5];
     ys.iter_mut().reverse_in_place();
diff --git a/src/libcoretest/lib.rs b/src/libcoretest/lib.rs
index 6059e49df19..e0e8e46af6c 100644
--- a/src/libcoretest/lib.rs
+++ b/src/libcoretest/lib.rs
@@ -10,8 +10,8 @@
 
 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
 #![cfg_attr(stage0, feature(custom_attribute))]
+
 #![feature(box_syntax)]
-#![feature(int_uint)]
 #![feature(unboxed_closures)]
 #![feature(unsafe_destructor)]
 #![feature(core)]
@@ -21,13 +21,11 @@
 #![feature(std_misc)]
 #![feature(libc)]
 #![feature(hash)]
-#![feature(io)]
-#![feature(collections)]
 #![feature(debug_builders)]
 #![feature(unique)]
 #![feature(step_by)]
 #![feature(slice_patterns)]
-#![allow(deprecated)] // rand
+#![feature(float_from_str_radix)]
 
 extern crate core;
 extern crate test;
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs
index cb2359873e9..b1c8aec3c35 100644
--- a/src/libcoretest/num/int_macros.rs
+++ b/src/libcoretest/num/int_macros.rs
@@ -8,12 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-macro_rules! int_module { ($T:ty, $T_i:ident) => (
+macro_rules! int_module { ($T:ident, $T_i:ident) => (
 #[cfg(test)]
 mod tests {
     use core::$T_i::*;
     use core::isize;
-    use core::num::{FromStrRadix, Int, SignedInt};
     use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr};
     use num;
 
@@ -129,30 +128,30 @@ mod tests {
 
     #[test]
     fn test_le() {
-        assert_eq!(Int::from_le(A.to_le()), A);
-        assert_eq!(Int::from_le(B.to_le()), B);
-        assert_eq!(Int::from_le(C.to_le()), C);
-        assert_eq!(Int::from_le(_0), _0);
-        assert_eq!(Int::from_le(_1), _1);
+        assert_eq!($T::from_le(A.to_le()), A);
+        assert_eq!($T::from_le(B.to_le()), B);
+        assert_eq!($T::from_le(C.to_le()), C);
+        assert_eq!($T::from_le(_0), _0);
+        assert_eq!($T::from_le(_1), _1);
         assert_eq!(_0.to_le(), _0);
         assert_eq!(_1.to_le(), _1);
     }
 
     #[test]
     fn test_be() {
-        assert_eq!(Int::from_be(A.to_be()), A);
-        assert_eq!(Int::from_be(B.to_be()), B);
-        assert_eq!(Int::from_be(C.to_be()), C);
-        assert_eq!(Int::from_be(_0), _0);
-        assert_eq!(Int::from_be(_1), _1);
+        assert_eq!($T::from_be(A.to_be()), A);
+        assert_eq!($T::from_be(B.to_be()), B);
+        assert_eq!($T::from_be(C.to_be()), C);
+        assert_eq!($T::from_be(_0), _0);
+        assert_eq!($T::from_be(_1), _1);
         assert_eq!(_0.to_be(), _0);
         assert_eq!(_1.to_be(), _1);
     }
 
     #[test]
     fn test_signed_checked_div() {
-        assert!(10.checked_div(2) == Some(5));
-        assert!(5.checked_div(0) == None);
+        assert!((10 as $T).checked_div(2) == Some(5));
+        assert!((5 as $T).checked_div(0) == None);
         assert!(isize::MIN.checked_div(-1) == None);
     }
 
@@ -180,26 +179,26 @@ mod tests {
 
     #[test]
     fn test_from_str_radix() {
-        assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("FFFF", 16), Ok(65535 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("Z", 36), Ok(35 as $T));
-
-        assert_eq!(FromStrRadix::from_str_radix("-123", 10), Ok(-123 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("-1001", 2), Ok(-9 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("-123", 8), Ok(-83 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("-123", 16), Ok(-291 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("-ffff", 16), Ok(-65535 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("-FFFF", 16), Ok(-65535 as i32));
-        assert_eq!(FromStrRadix::from_str_radix("-z", 36), Ok(-35 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("-Z", 36), Ok(-35 as $T));
-
-        assert_eq!(FromStrRadix::from_str_radix("Z", 35).ok(), None::<$T>);
-        assert_eq!(FromStrRadix::from_str_radix("-9", 2).ok(), None::<$T>);
+        assert_eq!($T::from_str_radix("123", 10), Ok(123 as $T));
+        assert_eq!($T::from_str_radix("1001", 2), Ok(9 as $T));
+        assert_eq!($T::from_str_radix("123", 8), Ok(83 as $T));
+        assert_eq!(i32::from_str_radix("123", 16), Ok(291 as i32));
+        assert_eq!(i32::from_str_radix("ffff", 16), Ok(65535 as i32));
+        assert_eq!(i32::from_str_radix("FFFF", 16), Ok(65535 as i32));
+        assert_eq!($T::from_str_radix("z", 36), Ok(35 as $T));
+        assert_eq!($T::from_str_radix("Z", 36), Ok(35 as $T));
+
+        assert_eq!($T::from_str_radix("-123", 10), Ok(-123 as $T));
+        assert_eq!($T::from_str_radix("-1001", 2), Ok(-9 as $T));
+        assert_eq!($T::from_str_radix("-123", 8), Ok(-83 as $T));
+        assert_eq!(i32::from_str_radix("-123", 16), Ok(-291 as i32));
+        assert_eq!(i32::from_str_radix("-ffff", 16), Ok(-65535 as i32));
+        assert_eq!(i32::from_str_radix("-FFFF", 16), Ok(-65535 as i32));
+        assert_eq!($T::from_str_radix("-z", 36), Ok(-35 as $T));
+        assert_eq!($T::from_str_radix("-Z", 36), Ok(-35 as $T));
+
+        assert_eq!($T::from_str_radix("Z", 35).ok(), None::<$T>);
+        assert_eq!($T::from_str_radix("-9", 2).ok(), None::<$T>);
     }
 
     #[test]
diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs
index 9087b87f640..85ca547da85 100644
--- a/src/libcoretest/num/mod.rs
+++ b/src/libcoretest/num/mod.rs
@@ -10,7 +10,6 @@
 
 use core::cmp::PartialEq;
 use core::fmt::Debug;
-use core::num::{NumCast, cast};
 use core::ops::{Add, Sub, Mul, Div, Rem};
 use core::marker::Copy;
 
@@ -32,18 +31,12 @@ mod u64;
 
 /// Helper function for testing numeric operations
 pub fn test_num<T>(ten: T, two: T) where
-    T: PartialEq + NumCast
+    T: PartialEq
      + Add<Output=T> + Sub<Output=T>
      + Mul<Output=T> + Div<Output=T>
      + Rem<Output=T> + Debug
      + Copy
 {
-    assert_eq!(ten.add(two),  cast(12).unwrap());
-    assert_eq!(ten.sub(two),  cast(8).unwrap());
-    assert_eq!(ten.mul(two),  cast(20).unwrap());
-    assert_eq!(ten.div(two),  cast(5).unwrap());
-    assert_eq!(ten.rem(two),  cast(0).unwrap());
-
     assert_eq!(ten.add(two),  ten + two);
     assert_eq!(ten.sub(two),  ten - two);
     assert_eq!(ten.mul(two),  ten * two);
@@ -56,33 +49,33 @@ mod test {
     use core::option::Option;
     use core::option::Option::{Some, None};
     use core::num::Float;
-    use core::num::from_str_radix;
 
     #[test]
     fn from_str_issue7588() {
-        let u : Option<u8> = from_str_radix("1000", 10).ok();
+        let u : Option<u8> = u8::from_str_radix("1000", 10).ok();
         assert_eq!(u, None);
-        let s : Option<i16> = from_str_radix("80000", 10).ok();
+        let s : Option<i16> = i16::from_str_radix("80000", 10).ok();
         assert_eq!(s, None);
-        let f : Option<f32> = from_str_radix("10000000000000000000000000000000000000000", 10).ok();
+        let s = "10000000000000000000000000000000000000000";
+        let f : Option<f32> = f32::from_str_radix(s, 10).ok();
         assert_eq!(f, Some(Float::infinity()));
-        let fe : Option<f32> = from_str_radix("1e40", 10).ok();
+        let fe : Option<f32> = f32::from_str_radix("1e40", 10).ok();
         assert_eq!(fe, Some(Float::infinity()));
     }
 
     #[test]
     fn test_from_str_radix_float() {
-        let x1 : Option<f64> = from_str_radix("-123.456", 10).ok();
+        let x1 : Option<f64> = f64::from_str_radix("-123.456", 10).ok();
         assert_eq!(x1, Some(-123.456));
-        let x2 : Option<f32> = from_str_radix("123.456", 10).ok();
+        let x2 : Option<f32> = f32::from_str_radix("123.456", 10).ok();
         assert_eq!(x2, Some(123.456));
-        let x3 : Option<f32> = from_str_radix("-0.0", 10).ok();
+        let x3 : Option<f32> = f32::from_str_radix("-0.0", 10).ok();
         assert_eq!(x3, Some(-0.0));
-        let x4 : Option<f32> = from_str_radix("0.0", 10).ok();
+        let x4 : Option<f32> = f32::from_str_radix("0.0", 10).ok();
         assert_eq!(x4, Some(0.0));
-        let x4 : Option<f32> = from_str_radix("1.0", 10).ok();
+        let x4 : Option<f32> = f32::from_str_radix("1.0", 10).ok();
         assert_eq!(x4, Some(1.0));
-        let x5 : Option<f32> = from_str_radix("-1.0", 10).ok();
+        let x5 : Option<f32> = f32::from_str_radix("-1.0", 10).ok();
         assert_eq!(x5, Some(-1.0));
     }
 
diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs
index 5e00692766d..1712345f9d9 100644
--- a/src/libcoretest/num/uint_macros.rs
+++ b/src/libcoretest/num/uint_macros.rs
@@ -8,11 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-macro_rules! uint_module { ($T:ty, $T_i:ident) => (
+macro_rules! uint_module { ($T:ident, $T_i:ident) => (
 #[cfg(test)]
 mod tests {
     use core::$T_i::*;
-    use core::num::Int;
     use num;
     use core::ops::{BitOr, BitAnd, BitXor, Shl, Shr, Not};
 
@@ -97,30 +96,30 @@ mod tests {
 
     #[test]
     fn test_le() {
-        assert_eq!(Int::from_le(A.to_le()), A);
-        assert_eq!(Int::from_le(B.to_le()), B);
-        assert_eq!(Int::from_le(C.to_le()), C);
-        assert_eq!(Int::from_le(_0), _0);
-        assert_eq!(Int::from_le(_1), _1);
+        assert_eq!($T::from_le(A.to_le()), A);
+        assert_eq!($T::from_le(B.to_le()), B);
+        assert_eq!($T::from_le(C.to_le()), C);
+        assert_eq!($T::from_le(_0), _0);
+        assert_eq!($T::from_le(_1), _1);
         assert_eq!(_0.to_le(), _0);
         assert_eq!(_1.to_le(), _1);
     }
 
     #[test]
     fn test_be() {
-        assert_eq!(Int::from_be(A.to_be()), A);
-        assert_eq!(Int::from_be(B.to_be()), B);
-        assert_eq!(Int::from_be(C.to_be()), C);
-        assert_eq!(Int::from_be(_0), _0);
-        assert_eq!(Int::from_be(_1), _1);
+        assert_eq!($T::from_be(A.to_be()), A);
+        assert_eq!($T::from_be(B.to_be()), B);
+        assert_eq!($T::from_be(C.to_be()), C);
+        assert_eq!($T::from_be(_0), _0);
+        assert_eq!($T::from_be(_1), _1);
         assert_eq!(_0.to_be(), _0);
         assert_eq!(_1.to_be(), _1);
     }
 
     #[test]
     fn test_unsigned_checked_div() {
-        assert!(10.checked_div(2) == Some(5));
-        assert!(5.checked_div(0) == None);
+        assert!((10 as $T).checked_div(2) == Some(5));
+        assert!((5 as $T).checked_div(0) == None);
     }
 }
 
diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs
index c5dd741c80c..4916e305b70 100644
--- a/src/librand/distributions/range.rs
+++ b/src/librand/distributions/range.rs
@@ -146,7 +146,6 @@ float_impl! { f64 }
 
 #[cfg(test)]
 mod tests {
-    use std::num::Int;
     use std::prelude::v1::*;
     use distributions::{Sample, IndependentSample};
     use super::Range as Range;
diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs
index c45ce12efb7..9ed827da8b2 100644
--- a/src/librustc_back/sha2.rs
+++ b/src/librustc_back/sha2.rs
@@ -540,14 +540,14 @@ mod tests {
     // A normal addition - no overflow occurs
     #[test]
     fn test_add_bytes_to_bits_ok() {
-        assert!(super::add_bytes_to_bits::<u64>(100, 10) == 180);
+        assert!(super::add_bytes_to_bits(100, 10) == 180);
     }
 
     // A simple failure case - adding 1 to the max value
     #[test]
     #[should_panic]
     fn test_add_bytes_to_bits_overflow() {
-        super::add_bytes_to_bits::<u64>(u64::MAX, 1);
+        super::add_bytes_to_bits(u64::MAX, 1);
     }
 
     struct Test {
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index a5bbbee790a..b1e14bf8f52 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -1625,7 +1625,7 @@ mod test_map {
 
     use super::HashMap;
     use super::Entry::{Occupied, Vacant};
-    use iter::{range_inclusive, range_step_inclusive, repeat};
+    use iter::{range_inclusive, repeat};
     use cell::RefCell;
     use rand::{thread_rng, Rng};
 
@@ -1861,7 +1861,7 @@ mod test_map {
             }
 
             // remove backwards
-            for i in range_step_inclusive(1000, 1, -1) {
+            for i in (1..1001).rev() {
                 assert!(m.remove(&i).is_some());
 
                 for j in range_inclusive(i, 1000) {
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index bcc109a71cb..3ed891d024f 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -772,7 +772,7 @@ mod tests {
     }
 
     fn eq(a: Option<OsString>, b: Option<&str>) {
-        assert_eq!(a.as_ref().map(|s| &**s), b.map(OsStr::from_str).map(|s| &*s));
+        assert_eq!(a.as_ref().map(|s| &**s), b.map(OsStr::new).map(|s| &*s));
     }
 
     #[test]
@@ -895,7 +895,7 @@ mod tests {
     fn join_paths_unix() {
         fn test_eq(input: &[&str], output: &str) -> bool {
             &*join_paths(input.iter().cloned()).unwrap() ==
-                OsStr::from_str(output)
+                OsStr::new(output)
         }
 
         assert!(test_eq(&[], ""));
@@ -911,7 +911,7 @@ mod tests {
     fn join_paths_windows() {
         fn test_eq(input: &[&str], output: &str) -> bool {
             &*join_paths(input.iter().cloned()).unwrap() ==
-                OsStr::from_str(output)
+                OsStr::new(output)
         }
 
         assert!(test_eq(&[], ""));
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index f7d15f9695c..96665259a4d 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -129,6 +129,7 @@
 #![feature(slice_patterns)]
 #![feature(debug_builders)]
 #![feature(zero_one)]
+#![cfg_attr(test, feature(float_from_str_radix))]
 #![cfg_attr(test, feature(test, rustc_private, std_misc))]
 
 // Don't link to std. We are std.
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 430fec4ff2e..0efc04ef83c 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -15,11 +15,13 @@
 #![allow(unsigned_negation)]
 #![doc(primitive = "f32")]
 
-use intrinsics;
-use libc::c_int;
-use num::FpCategory;
+use prelude::v1::*;
 
 use core::num;
+use intrinsics;
+use libc::c_int;
+use num::{FpCategory, ParseFloatError};
+use sys_common::FromInner;
 
 pub use core::f32::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
 pub use core::f32::{MIN_EXP, MAX_EXP, MIN_10_EXP};
@@ -72,6 +74,12 @@ mod cmath {
 #[lang = "f32"]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl f32 {
+    /// Parses a float as with a given radix
+    #[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
+    pub fn from_str_radix(s: &str, radix: u32) -> Result<f32, ParseFloatError> {
+        num::Float::from_str_radix(s, radix).map_err(FromInner::from_inner)
+    }
+
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
@@ -1021,7 +1029,7 @@ impl f32 {
     #[inline]
     pub fn acosh(self) -> f32 {
         match self {
-            x if x < 1.0 => num::Float::nan(),
+            x if x < 1.0 => ::f32::NAN,
             x => (x + ((x * x) - 1.0).sqrt()).ln(),
         }
     }
@@ -1047,6 +1055,7 @@ impl f32 {
 
 #[cfg(test)]
 mod tests {
+    use f32;
     use f32::*;
     use num::*;
     use num::FpCategory as Fp;
@@ -1070,7 +1079,7 @@ mod tests {
 
     #[test]
     fn test_nan() {
-        let nan: f32 = Float::nan();
+        let nan: f32 = f32::NAN;
         assert!(nan.is_nan());
         assert!(!nan.is_infinite());
         assert!(!nan.is_finite());
@@ -1082,7 +1091,7 @@ mod tests {
 
     #[test]
     fn test_infinity() {
-        let inf: f32 = Float::infinity();
+        let inf: f32 = f32::INFINITY;
         assert!(inf.is_infinite());
         assert!(!inf.is_finite());
         assert!(inf.is_sign_positive());
@@ -1094,7 +1103,7 @@ mod tests {
 
     #[test]
     fn test_neg_infinity() {
-        let neg_inf: f32 = Float::neg_infinity();
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert!(neg_inf.is_infinite());
         assert!(!neg_inf.is_finite());
         assert!(!neg_inf.is_sign_positive());
@@ -1106,7 +1115,7 @@ mod tests {
 
     #[test]
     fn test_zero() {
-        let zero: f32 = Float::zero();
+        let zero: f32 = 0.0f32;
         assert_eq!(0.0, zero);
         assert!(!zero.is_infinite());
         assert!(zero.is_finite());
@@ -1119,7 +1128,7 @@ mod tests {
 
     #[test]
     fn test_neg_zero() {
-        let neg_zero: f32 = Float::neg_zero();
+        let neg_zero: f32 = -0.0;
         assert_eq!(0.0, neg_zero);
         assert!(!neg_zero.is_infinite());
         assert!(neg_zero.is_finite());
@@ -1132,7 +1141,7 @@ mod tests {
 
     #[test]
     fn test_one() {
-        let one: f32 = Float::one();
+        let one: f32 = 1.0f32;
         assert_eq!(1.0, one);
         assert!(!one.is_infinite());
         assert!(one.is_finite());
@@ -1145,9 +1154,9 @@ mod tests {
 
     #[test]
     fn test_is_nan() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert!(nan.is_nan());
         assert!(!0.0f32.is_nan());
         assert!(!5.3f32.is_nan());
@@ -1158,9 +1167,9 @@ mod tests {
 
     #[test]
     fn test_is_infinite() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert!(!nan.is_infinite());
         assert!(inf.is_infinite());
         assert!(neg_inf.is_infinite());
@@ -1171,9 +1180,9 @@ mod tests {
 
     #[test]
     fn test_is_finite() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert!(!nan.is_finite());
         assert!(!inf.is_finite());
         assert!(!neg_inf.is_finite());
@@ -1184,11 +1193,11 @@ mod tests {
 
     #[test]
     fn test_is_normal() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let zero: f32 = Float::zero();
-        let neg_zero: f32 = Float::neg_zero();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let zero: f32 = 0.0f32;
+        let neg_zero: f32 = -0.0;
         assert!(!nan.is_normal());
         assert!(!inf.is_normal());
         assert!(!neg_inf.is_normal());
@@ -1201,11 +1210,11 @@ mod tests {
 
     #[test]
     fn test_classify() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let zero: f32 = Float::zero();
-        let neg_zero: f32 = Float::neg_zero();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let zero: f32 = 0.0f32;
+        let neg_zero: f32 = -0.0;
         assert_eq!(nan.classify(), Fp::Nan);
         assert_eq!(inf.classify(), Fp::Infinite);
         assert_eq!(neg_inf.classify(), Fp::Infinite);
@@ -1348,9 +1357,9 @@ mod tests {
 
     #[test]
     fn test_mul_add() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_approx_eq!(12.3f32.mul_add(4.5, 6.7), 62.05);
         assert_approx_eq!((-12.3f32).mul_add(-4.5, -6.7), 48.65);
         assert_approx_eq!(0.0f32.mul_add(8.9, 1.2), 1.2);
@@ -1364,9 +1373,9 @@ mod tests {
 
     #[test]
     fn test_recip() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(1.0f32.recip(), 1.0);
         assert_eq!(2.0f32.recip(), 0.5);
         assert_eq!((-0.4f32).recip(), -2.5);
@@ -1378,9 +1387,9 @@ mod tests {
 
     #[test]
     fn test_powi() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(1.0f32.powi(1), 1.0);
         assert_approx_eq!((-3.1f32).powi(2), 9.61);
         assert_approx_eq!(5.9f32.powi(-2), 0.028727);
@@ -1392,9 +1401,9 @@ mod tests {
 
     #[test]
     fn test_powf() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(1.0f32.powf(1.0), 1.0);
         assert_approx_eq!(3.4f32.powf(4.5), 246.408218);
         assert_approx_eq!(2.7f32.powf(-3.2), 0.041652);
@@ -1418,29 +1427,14 @@ mod tests {
     }
 
     #[test]
-    fn test_rsqrt() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        assert!(nan.rsqrt().is_nan());
-        assert_eq!(inf.rsqrt(), 0.0);
-        assert!(neg_inf.rsqrt().is_nan());
-        assert!((-1.0f32).rsqrt().is_nan());
-        assert_eq!((-0.0f32).rsqrt(), neg_inf);
-        assert_eq!(0.0f32.rsqrt(), inf);
-        assert_eq!(1.0f32.rsqrt(), 1.0);
-        assert_eq!(4.0f32.rsqrt(), 0.5);
-    }
-
-    #[test]
     fn test_exp() {
         assert_eq!(1.0, 0.0f32.exp());
         assert_approx_eq!(2.718282, 1.0f32.exp());
         assert_approx_eq!(148.413162, 5.0f32.exp());
 
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
         assert_eq!(inf, inf.exp());
         assert_eq!(0.0, neg_inf.exp());
         assert!(nan.exp().is_nan());
@@ -1451,9 +1445,9 @@ mod tests {
         assert_eq!(32.0, 5.0f32.exp2());
         assert_eq!(1.0, 0.0f32.exp2());
 
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
         assert_eq!(inf, inf.exp2());
         assert_eq!(0.0, neg_inf.exp2());
         assert!(nan.exp2().is_nan());
@@ -1461,9 +1455,9 @@ mod tests {
 
     #[test]
     fn test_ln() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_approx_eq!(1.0f32.exp().ln(), 1.0);
         assert!(nan.ln().is_nan());
         assert_eq!(inf.ln(), inf);
@@ -1476,12 +1470,12 @@ mod tests {
 
     #[test]
     fn test_log() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(10.0f32.log(10.0), 1.0);
         assert_approx_eq!(2.3f32.log(3.5), 0.664858);
-        assert_eq!(1.0f32.exp().log(1.0.exp()), 1.0);
+        assert_eq!(1.0f32.exp().log(1.0f32.exp()), 1.0);
         assert!(1.0f32.log(1.0).is_nan());
         assert!(1.0f32.log(-13.9).is_nan());
         assert!(nan.log(2.3).is_nan());
@@ -1494,9 +1488,9 @@ mod tests {
 
     #[test]
     fn test_log2() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_approx_eq!(10.0f32.log2(), 3.321928);
         assert_approx_eq!(2.3f32.log2(), 1.201634);
         assert_approx_eq!(1.0f32.exp().log2(), 1.442695);
@@ -1510,9 +1504,9 @@ mod tests {
 
     #[test]
     fn test_log10() {
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(10.0f32.log10(), 1.0);
         assert_approx_eq!(2.3f32.log10(), 0.361728);
         assert_approx_eq!(1.0f32.exp().log10(), 0.434294);
@@ -1528,9 +1522,9 @@ mod tests {
     #[test]
     fn test_to_degrees() {
         let pi: f32 = consts::PI;
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(0.0f32.to_degrees(), 0.0);
         assert_approx_eq!((-5.8f32).to_degrees(), -332.315521);
         assert_eq!(pi.to_degrees(), 180.0);
@@ -1542,9 +1536,9 @@ mod tests {
     #[test]
     fn test_to_radians() {
         let pi: f32 = consts::PI;
-        let nan: f32 = Float::nan();
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
+        let nan: f32 = f32::NAN;
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
         assert_eq!(0.0f32.to_radians(), 0.0);
         assert_approx_eq!(154.6f32.to_radians(), 2.698279);
         assert_approx_eq!((-332.31f32).to_radians(), -5.799903);
@@ -1558,40 +1552,40 @@ mod tests {
     fn test_ldexp() {
         // We have to use from_str until base-2 exponents
         // 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();
-        let f3: f32 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap();
-        assert_eq!(1f32.ldexp(-123), f1);
-        assert_eq!(1f32.ldexp(-111), f2);
-        assert_eq!(Float::ldexp(1.75f32, -12), f3);
+        let f1: f32 = f32::from_str_radix("1p-123", 16).unwrap();
+        let f2: f32 = f32::from_str_radix("1p-111", 16).unwrap();
+        let f3: f32 = f32::from_str_radix("1.Cp-12", 16).unwrap();
+        assert_eq!(f32::ldexp(1f32, -123), f1);
+        assert_eq!(f32::ldexp(1f32, -111), f2);
+        assert_eq!(f32::ldexp(1.75f32, -12), f3);
 
-        assert_eq!(Float::ldexp(0f32, -123), 0f32);
-        assert_eq!(Float::ldexp(-0f32, -123), -0f32);
+        assert_eq!(f32::ldexp(0f32, -123), 0f32);
+        assert_eq!(f32::ldexp(-0f32, -123), -0f32);
 
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
-        assert_eq!(Float::ldexp(inf, -123), inf);
-        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
-        assert!(Float::ldexp(nan, -123).is_nan());
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
+        assert_eq!(f32::ldexp(inf, -123), inf);
+        assert_eq!(f32::ldexp(neg_inf, -123), neg_inf);
+        assert!(f32::ldexp(nan, -123).is_nan());
     }
 
     #[test]
     fn test_frexp() {
         // We have to use from_str until base-2 exponents
         // 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();
-        let f3: f32 = FromStrRadix::from_str_radix("1.Cp-123", 16).unwrap();
+        let f1: f32 = f32::from_str_radix("1p-123", 16).unwrap();
+        let f2: f32 = f32::from_str_radix("1p-111", 16).unwrap();
+        let f3: f32 = f32::from_str_radix("1.Cp-123", 16).unwrap();
         let (x1, exp1) = f1.frexp();
         let (x2, exp2) = f2.frexp();
         let (x3, exp3) = f3.frexp();
         assert_eq!((x1, exp1), (0.5f32, -122));
         assert_eq!((x2, exp2), (0.5f32, -110));
         assert_eq!((x3, exp3), (0.875f32, -122));
-        assert_eq!(Float::ldexp(x1, exp1), f1);
-        assert_eq!(Float::ldexp(x2, exp2), f2);
-        assert_eq!(Float::ldexp(x3, exp3), f3);
+        assert_eq!(f32::ldexp(x1, exp1), f1);
+        assert_eq!(f32::ldexp(x2, exp2), f2);
+        assert_eq!(f32::ldexp(x3, exp3), f3);
 
         assert_eq!(0f32.frexp(), (0f32, 0));
         assert_eq!((-0f32).frexp(), (-0f32, 0));
@@ -1599,9 +1593,9 @@ mod tests {
 
     #[test] #[cfg_attr(windows, ignore)] // FIXME #8755
     fn test_frexp_nowin() {
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
         assert_eq!(match inf.frexp() { (x, _) => x }, inf);
         assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf);
         assert!(match nan.frexp() { (x, _) => x.is_nan() })
@@ -1630,9 +1624,9 @@ mod tests {
         assert_eq!(0.0f32.asinh(), 0.0f32);
         assert_eq!((-0.0f32).asinh(), -0.0f32);
 
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
         assert_eq!(inf.asinh(), inf);
         assert_eq!(neg_inf.asinh(), neg_inf);
         assert!(nan.asinh().is_nan());
@@ -1645,9 +1639,9 @@ mod tests {
         assert_eq!(1.0f32.acosh(), 0.0f32);
         assert!(0.999f32.acosh().is_nan());
 
-        let inf: f32 = Float::infinity();
-        let neg_inf: f32 = Float::neg_infinity();
-        let nan: f32 = Float::nan();
+        let inf: f32 = f32::INFINITY;
+        let neg_inf: f32 = f32::NEG_INFINITY;
+        let nan: f32 = f32::NAN;
         assert_eq!(inf.acosh(), inf);
         assert!(neg_inf.acosh().is_nan());
         assert!(nan.acosh().is_nan());
@@ -1660,17 +1654,17 @@ mod tests {
         assert_eq!(0.0f32.atanh(), 0.0f32);
         assert_eq!((-0.0f32).atanh(), -0.0f32);
 
-        let inf32: f32 = Float::infinity();
-        let neg_inf32: f32 = Float::neg_infinity();
+        let inf32: f32 = f32::INFINITY;
+        let neg_inf32: f32 = f32::NEG_INFINITY;
         assert_eq!(1.0f32.atanh(), inf32);
         assert_eq!((-1.0f32).atanh(), neg_inf32);
 
         assert!(2f64.atanh().atanh().is_nan());
         assert!((-2f64).atanh().atanh().is_nan());
 
-        let inf64: f32 = Float::infinity();
-        let neg_inf64: f32 = Float::neg_infinity();
-        let nan32: f32 = Float::nan();
+        let inf64: f32 = f32::INFINITY;
+        let neg_inf64: f32 = f32::NEG_INFINITY;
+        let nan32: f32 = f32::NAN;
         assert!(inf64.atanh().is_nan());
         assert!(neg_inf64.atanh().is_nan());
         assert!(nan32.atanh().is_nan());
@@ -1692,9 +1686,9 @@ mod tests {
         let frac_pi_8: f32 = consts::FRAC_PI_8;
         let frac_1_pi: f32 = consts::FRAC_1_PI;
         let frac_2_pi: f32 = consts::FRAC_2_PI;
-        let frac_2_sqrtpi: f32 = consts::FRAC_2_SQRTPI;
-        let sqrt2: f32 = consts::SQRT2;
-        let frac_1_sqrt2: f32 = consts::FRAC_1_SQRT2;
+        let frac_2_sqrtpi: f32 = consts::FRAC_2_SQRT_PI;
+        let sqrt2: f32 = consts::SQRT_2;
+        let frac_1_sqrt2: f32 = consts::FRAC_1_SQRT_2;
         let e: f32 = consts::E;
         let log2_e: f32 = consts::LOG2_E;
         let log10_e: f32 = consts::LOG10_E;
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index bd50a087c71..e1497f3958d 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -14,11 +14,13 @@
 #![allow(missing_docs)]
 #![doc(primitive = "f64")]
 
-use intrinsics;
-use libc::c_int;
-use num::FpCategory;
+use prelude::v1::*;
 
 use core::num;
+use intrinsics;
+use libc::c_int;
+use num::{FpCategory, ParseFloatError};
+use sys_common::FromInner;
 
 pub use core::f64::{RADIX, MANTISSA_DIGITS, DIGITS, EPSILON};
 pub use core::f64::{MIN_EXP, MAX_EXP, MIN_10_EXP};
@@ -80,6 +82,12 @@ mod cmath {
 #[lang = "f64"]
 #[stable(feature = "rust1", since = "1.0.0")]
 impl f64 {
+    /// Parses a float as with a given radix
+    #[unstable(feature = "float_from_str_radix", reason = "recently moved API")]
+    pub fn from_str_radix(s: &str, radix: u32) -> Result<f64, ParseFloatError> {
+        num::Float::from_str_radix(s, radix).map_err(FromInner::from_inner)
+    }
+
     /// Returns `true` if this value is `NaN` and false otherwise.
     ///
     /// ```
@@ -435,22 +443,6 @@ impl f64 {
     #[inline]
     pub fn sqrt(self) -> f64 { num::Float::sqrt(self) }
 
-    /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
-    ///
-    /// ```
-    /// # #![feature(std_misc)]
-    /// let f = 4.0_f64;
-    ///
-    /// let abs_difference = (f.rsqrt() - 0.5).abs();
-    ///
-    /// assert!(abs_difference < 1e-10);
-    /// ```
-    #[unstable(feature = "std_misc",
-               reason = "unsure about its place in the world")]
-    #[deprecated(since = "1.0.0", reason = "use self.sqrt().recip() instead")]
-    #[inline]
-    pub fn rsqrt(self) -> f64 { num::Float::rsqrt(self) }
-
     /// Returns `e^(self)`, (the exponential function).
     ///
     /// ```
@@ -1013,7 +1005,7 @@ impl f64 {
     #[inline]
     pub fn acosh(self) -> f64 {
         match self {
-            x if x < 1.0 => num::Float::nan(),
+            x if x < 1.0 => NAN,
             x => (x + ((x * x) - 1.0).sqrt()).ln(),
         }
     }
@@ -1039,6 +1031,7 @@ impl f64 {
 
 #[cfg(test)]
 mod tests {
+    use f64;
     use f64::*;
     use num::*;
     use num::FpCategory as Fp;
@@ -1062,7 +1055,7 @@ mod tests {
 
     #[test]
     fn test_nan() {
-        let nan: f64 = Float::nan();
+        let nan: f64 = NAN;
         assert!(nan.is_nan());
         assert!(!nan.is_infinite());
         assert!(!nan.is_finite());
@@ -1074,7 +1067,7 @@ mod tests {
 
     #[test]
     fn test_infinity() {
-        let inf: f64 = Float::infinity();
+        let inf: f64 = INFINITY;
         assert!(inf.is_infinite());
         assert!(!inf.is_finite());
         assert!(inf.is_sign_positive());
@@ -1086,7 +1079,7 @@ mod tests {
 
     #[test]
     fn test_neg_infinity() {
-        let neg_inf: f64 = Float::neg_infinity();
+        let neg_inf: f64 = NEG_INFINITY;
         assert!(neg_inf.is_infinite());
         assert!(!neg_inf.is_finite());
         assert!(!neg_inf.is_sign_positive());
@@ -1098,7 +1091,7 @@ mod tests {
 
     #[test]
     fn test_zero() {
-        let zero: f64 = Float::zero();
+        let zero: f64 = 0.0f64;
         assert_eq!(0.0, zero);
         assert!(!zero.is_infinite());
         assert!(zero.is_finite());
@@ -1111,7 +1104,7 @@ mod tests {
 
     #[test]
     fn test_neg_zero() {
-        let neg_zero: f64 = Float::neg_zero();
+        let neg_zero: f64 = -0.0;
         assert_eq!(0.0, neg_zero);
         assert!(!neg_zero.is_infinite());
         assert!(neg_zero.is_finite());
@@ -1124,7 +1117,7 @@ mod tests {
 
     #[test]
     fn test_one() {
-        let one: f64 = Float::one();
+        let one: f64 = 1.0f64;
         assert_eq!(1.0, one);
         assert!(!one.is_infinite());
         assert!(one.is_finite());
@@ -1137,9 +1130,9 @@ mod tests {
 
     #[test]
     fn test_is_nan() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert!(nan.is_nan());
         assert!(!0.0f64.is_nan());
         assert!(!5.3f64.is_nan());
@@ -1150,9 +1143,9 @@ mod tests {
 
     #[test]
     fn test_is_infinite() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert!(!nan.is_infinite());
         assert!(inf.is_infinite());
         assert!(neg_inf.is_infinite());
@@ -1163,9 +1156,9 @@ mod tests {
 
     #[test]
     fn test_is_finite() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert!(!nan.is_finite());
         assert!(!inf.is_finite());
         assert!(!neg_inf.is_finite());
@@ -1176,11 +1169,11 @@ mod tests {
 
     #[test]
     fn test_is_normal() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let zero: f64 = Float::zero();
-        let neg_zero: f64 = Float::neg_zero();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let zero: f64 = 0.0f64;
+        let neg_zero: f64 = -0.0;
         assert!(!nan.is_normal());
         assert!(!inf.is_normal());
         assert!(!neg_inf.is_normal());
@@ -1193,11 +1186,11 @@ mod tests {
 
     #[test]
     fn test_classify() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let zero: f64 = Float::zero();
-        let neg_zero: f64 = Float::neg_zero();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let zero: f64 = 0.0f64;
+        let neg_zero: f64 = -0.0;
         assert_eq!(nan.classify(), Fp::Nan);
         assert_eq!(inf.classify(), Fp::Infinite);
         assert_eq!(neg_inf.classify(), Fp::Infinite);
@@ -1339,9 +1332,9 @@ mod tests {
 
     #[test]
     fn test_mul_add() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_approx_eq!(12.3f64.mul_add(4.5, 6.7), 62.05);
         assert_approx_eq!((-12.3f64).mul_add(-4.5, -6.7), 48.65);
         assert_approx_eq!(0.0f64.mul_add(8.9, 1.2), 1.2);
@@ -1355,9 +1348,9 @@ mod tests {
 
     #[test]
     fn test_recip() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(1.0f64.recip(), 1.0);
         assert_eq!(2.0f64.recip(), 0.5);
         assert_eq!((-0.4f64).recip(), -2.5);
@@ -1369,9 +1362,9 @@ mod tests {
 
     #[test]
     fn test_powi() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(1.0f64.powi(1), 1.0);
         assert_approx_eq!((-3.1f64).powi(2), 9.61);
         assert_approx_eq!(5.9f64.powi(-2), 0.028727);
@@ -1383,9 +1376,9 @@ mod tests {
 
     #[test]
     fn test_powf() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(1.0f64.powf(1.0), 1.0);
         assert_approx_eq!(3.4f64.powf(4.5), 246.408183);
         assert_approx_eq!(2.7f64.powf(-3.2), 0.041652);
@@ -1409,29 +1402,14 @@ mod tests {
     }
 
     #[test]
-    fn test_rsqrt() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        assert!(nan.rsqrt().is_nan());
-        assert_eq!(inf.rsqrt(), 0.0);
-        assert!(neg_inf.rsqrt().is_nan());
-        assert!((-1.0f64).rsqrt().is_nan());
-        assert_eq!((-0.0f64).rsqrt(), neg_inf);
-        assert_eq!(0.0f64.rsqrt(), inf);
-        assert_eq!(1.0f64.rsqrt(), 1.0);
-        assert_eq!(4.0f64.rsqrt(), 0.5);
-    }
-
-    #[test]
     fn test_exp() {
         assert_eq!(1.0, 0.0f64.exp());
         assert_approx_eq!(2.718282, 1.0f64.exp());
         assert_approx_eq!(148.413159, 5.0f64.exp());
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(inf, inf.exp());
         assert_eq!(0.0, neg_inf.exp());
         assert!(nan.exp().is_nan());
@@ -1442,9 +1420,9 @@ mod tests {
         assert_eq!(32.0, 5.0f64.exp2());
         assert_eq!(1.0, 0.0f64.exp2());
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(inf, inf.exp2());
         assert_eq!(0.0, neg_inf.exp2());
         assert!(nan.exp2().is_nan());
@@ -1452,9 +1430,9 @@ mod tests {
 
     #[test]
     fn test_ln() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_approx_eq!(1.0f64.exp().ln(), 1.0);
         assert!(nan.ln().is_nan());
         assert_eq!(inf.ln(), inf);
@@ -1467,12 +1445,12 @@ mod tests {
 
     #[test]
     fn test_log() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(10.0f64.log(10.0), 1.0);
         assert_approx_eq!(2.3f64.log(3.5), 0.664858);
-        assert_eq!(1.0f64.exp().log(1.0.exp()), 1.0);
+        assert_eq!(1.0f64.exp().log(1.0f64.exp()), 1.0);
         assert!(1.0f64.log(1.0).is_nan());
         assert!(1.0f64.log(-13.9).is_nan());
         assert!(nan.log(2.3).is_nan());
@@ -1485,9 +1463,9 @@ mod tests {
 
     #[test]
     fn test_log2() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_approx_eq!(10.0f64.log2(), 3.321928);
         assert_approx_eq!(2.3f64.log2(), 1.201634);
         assert_approx_eq!(1.0f64.exp().log2(), 1.442695);
@@ -1501,9 +1479,9 @@ mod tests {
 
     #[test]
     fn test_log10() {
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(10.0f64.log10(), 1.0);
         assert_approx_eq!(2.3f64.log10(), 0.361728);
         assert_approx_eq!(1.0f64.exp().log10(), 0.434294);
@@ -1519,9 +1497,9 @@ mod tests {
     #[test]
     fn test_to_degrees() {
         let pi: f64 = consts::PI;
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(0.0f64.to_degrees(), 0.0);
         assert_approx_eq!((-5.8f64).to_degrees(), -332.315521);
         assert_eq!(pi.to_degrees(), 180.0);
@@ -1533,9 +1511,9 @@ mod tests {
     #[test]
     fn test_to_radians() {
         let pi: f64 = consts::PI;
-        let nan: f64 = Float::nan();
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
+        let nan: f64 = NAN;
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
         assert_eq!(0.0f64.to_radians(), 0.0);
         assert_approx_eq!(154.6f64.to_radians(), 2.698279);
         assert_approx_eq!((-332.31f64).to_radians(), -5.799903);
@@ -1549,40 +1527,40 @@ mod tests {
     fn test_ldexp() {
         // We have to use from_str until base-2 exponents
         // 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();
-        let f3: f64 = FromStrRadix::from_str_radix("1.Cp-12", 16).unwrap();
-        assert_eq!(1f64.ldexp(-123), f1);
-        assert_eq!(1f64.ldexp(-111), f2);
-        assert_eq!(Float::ldexp(1.75f64, -12), f3);
+        let f1: f64 = f64::from_str_radix("1p-123", 16).unwrap();
+        let f2: f64 = f64::from_str_radix("1p-111", 16).unwrap();
+        let f3: f64 = f64::from_str_radix("1.Cp-12", 16).unwrap();
+        assert_eq!(f64::ldexp(1f64, -123), f1);
+        assert_eq!(f64::ldexp(1f64, -111), f2);
+        assert_eq!(f64::ldexp(1.75f64, -12), f3);
 
-        assert_eq!(Float::ldexp(0f64, -123), 0f64);
-        assert_eq!(Float::ldexp(-0f64, -123), -0f64);
+        assert_eq!(f64::ldexp(0f64, -123), 0f64);
+        assert_eq!(f64::ldexp(-0f64, -123), -0f64);
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
-        assert_eq!(Float::ldexp(inf, -123), inf);
-        assert_eq!(Float::ldexp(neg_inf, -123), neg_inf);
-        assert!(Float::ldexp(nan, -123).is_nan());
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
+        assert_eq!(f64::ldexp(inf, -123), inf);
+        assert_eq!(f64::ldexp(neg_inf, -123), neg_inf);
+        assert!(f64::ldexp(nan, -123).is_nan());
     }
 
     #[test]
     fn test_frexp() {
         // We have to use from_str until base-2 exponents
         // 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();
-        let f3: f64 = FromStrRadix::from_str_radix("1.Cp-123", 16).unwrap();
+        let f1: f64 = f64::from_str_radix("1p-123", 16).unwrap();
+        let f2: f64 = f64::from_str_radix("1p-111", 16).unwrap();
+        let f3: f64 = f64::from_str_radix("1.Cp-123", 16).unwrap();
         let (x1, exp1) = f1.frexp();
         let (x2, exp2) = f2.frexp();
         let (x3, exp3) = f3.frexp();
         assert_eq!((x1, exp1), (0.5f64, -122));
         assert_eq!((x2, exp2), (0.5f64, -110));
         assert_eq!((x3, exp3), (0.875f64, -122));
-        assert_eq!(Float::ldexp(x1, exp1), f1);
-        assert_eq!(Float::ldexp(x2, exp2), f2);
-        assert_eq!(Float::ldexp(x3, exp3), f3);
+        assert_eq!(f64::ldexp(x1, exp1), f1);
+        assert_eq!(f64::ldexp(x2, exp2), f2);
+        assert_eq!(f64::ldexp(x3, exp3), f3);
 
         assert_eq!(0f64.frexp(), (0f64, 0));
         assert_eq!((-0f64).frexp(), (-0f64, 0));
@@ -1590,9 +1568,9 @@ mod tests {
 
     #[test] #[cfg_attr(windows, ignore)] // FIXME #8755
     fn test_frexp_nowin() {
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(match inf.frexp() { (x, _) => x }, inf);
         assert_eq!(match neg_inf.frexp() { (x, _) => x }, neg_inf);
         assert!(match nan.frexp() { (x, _) => x.is_nan() })
@@ -1621,9 +1599,9 @@ mod tests {
         assert_eq!(0.0f64.asinh(), 0.0f64);
         assert_eq!((-0.0f64).asinh(), -0.0f64);
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(inf.asinh(), inf);
         assert_eq!(neg_inf.asinh(), neg_inf);
         assert!(nan.asinh().is_nan());
@@ -1636,9 +1614,9 @@ mod tests {
         assert_eq!(1.0f64.acosh(), 0.0f64);
         assert!(0.999f64.acosh().is_nan());
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(inf.acosh(), inf);
         assert!(neg_inf.acosh().is_nan());
         assert!(nan.acosh().is_nan());
@@ -1651,9 +1629,9 @@ mod tests {
         assert_eq!(0.0f64.atanh(), 0.0f64);
         assert_eq!((-0.0f64).atanh(), -0.0f64);
 
-        let inf: f64 = Float::infinity();
-        let neg_inf: f64 = Float::neg_infinity();
-        let nan: f64 = Float::nan();
+        let inf: f64 = INFINITY;
+        let neg_inf: f64 = NEG_INFINITY;
+        let nan: f64 = NAN;
         assert_eq!(1.0f64.atanh(), inf);
         assert_eq!((-1.0f64).atanh(), neg_inf);
         assert!(2f64.atanh().atanh().is_nan());
@@ -1677,9 +1655,9 @@ mod tests {
         let frac_pi_8: f64 = consts::FRAC_PI_8;
         let frac_1_pi: f64 = consts::FRAC_1_PI;
         let frac_2_pi: f64 = consts::FRAC_2_PI;
-        let frac_2_sqrtpi: f64 = consts::FRAC_2_SQRTPI;
-        let sqrt2: f64 = consts::SQRT2;
-        let frac_1_sqrt2: f64 = consts::FRAC_1_SQRT2;
+        let frac_2_sqrtpi: f64 = consts::FRAC_2_SQRT_PI;
+        let sqrt2: f64 = consts::SQRT_2;
+        let frac_1_sqrt2: f64 = consts::FRAC_1_SQRT_2;
         let e: f64 = consts::E;
         let log2_e: f64 = consts::LOG2_E;
         let log10_e: f64 = consts::LOG10_E;
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index dbe06b77329..cd26be013c4 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -16,27 +16,26 @@
 #![stable(feature = "rust1", since = "1.0.0")]
 #![allow(missing_docs)]
 
-#[cfg(test)] use fmt::Debug;
+use fmt;
+use core::num;
 
 pub use core::num::{Zero, One};
-pub use core::num::{FpCategory, ParseIntError, ParseFloatError};
+pub use core::num::{FpCategory, ParseIntError};
 pub use core::num::{wrapping, Wrapping};
 
+#[cfg(test)] use ops::{Add, Sub, Mul, Div, Rem};
+#[cfg(test)] use cmp::PartialEq;
+#[cfg(test)] use marker::Copy;
+
 /// Helper function for testing numeric operations
 #[cfg(test)]
 pub fn test_num<T>(ten: T, two: T) where
-    T: PartialEq + NumCast
+    T: PartialEq
      + Add<Output=T> + Sub<Output=T>
      + Mul<Output=T> + Div<Output=T>
-     + Rem<Output=T> + Debug
+     + Rem<Output=T> + fmt::Debug
      + Copy
 {
-    assert_eq!(ten.add(two),  cast(12).unwrap());
-    assert_eq!(ten.sub(two),  cast(8).unwrap());
-    assert_eq!(ten.mul(two),  cast(20).unwrap());
-    assert_eq!(ten.div(two),  cast(5).unwrap());
-    assert_eq!(ten.rem(two),  cast(0).unwrap());
-
     assert_eq!(ten.add(two),  ten + two);
     assert_eq!(ten.sub(two),  ten - two);
     assert_eq!(ten.mul(two),  ten * two);
@@ -44,6 +43,31 @@ pub fn test_num<T>(ten: T, two: T) where
     assert_eq!(ten.rem(two),  ten % two);
 }
 
+/// An error which can be returned when parsing a float.
+#[derive(Debug, Clone, PartialEq)]
+#[stable(feature = "rust1", since = "1.0.0")]
+pub struct ParseFloatError { inner: num::ParseFloatError }
+
+impl ::sys_common::FromInner<num::ParseFloatError> for ParseFloatError {
+    fn from_inner(inner: num::ParseFloatError) -> ParseFloatError {
+        ParseFloatError { inner: inner }
+    }
+}
+
+impl ParseFloatError {
+    #[unstable(feature = "core", reason = "available through Error trait")]
+    pub fn description(&self) -> &str {
+        self.inner.description()
+    }
+}
+
+#[stable(feature = "rust1", since = "1.0.0")]
+impl fmt::Display for ParseFloatError {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        self.description().fmt(f)
+    }
+}
+
 #[cfg(test)]
 mod tests {
     use core::prelude::*;
@@ -59,432 +83,7 @@ mod tests {
     use u64;
     use usize;
     use string::ToString;
-
-    macro_rules! test_cast_20 {
-        ($_20:expr) => ({
-            let _20 = $_20;
-
-            assert_eq!(20usize, _20.to_uint().unwrap());
-            assert_eq!(20u8,    _20.to_u8().unwrap());
-            assert_eq!(20u16,   _20.to_u16().unwrap());
-            assert_eq!(20u32,   _20.to_u32().unwrap());
-            assert_eq!(20u64,   _20.to_u64().unwrap());
-            assert_eq!(20,      _20.to_int().unwrap());
-            assert_eq!(20i8,    _20.to_i8().unwrap());
-            assert_eq!(20i16,   _20.to_i16().unwrap());
-            assert_eq!(20i32,   _20.to_i32().unwrap());
-            assert_eq!(20i64,   _20.to_i64().unwrap());
-            assert_eq!(20f32,   _20.to_f32().unwrap());
-            assert_eq!(20f64,   _20.to_f64().unwrap());
-
-            assert_eq!(_20, NumCast::from(20usize).unwrap());
-            assert_eq!(_20, NumCast::from(20u8).unwrap());
-            assert_eq!(_20, NumCast::from(20u16).unwrap());
-            assert_eq!(_20, NumCast::from(20u32).unwrap());
-            assert_eq!(_20, NumCast::from(20u64).unwrap());
-            assert_eq!(_20, NumCast::from(20).unwrap());
-            assert_eq!(_20, NumCast::from(20i8).unwrap());
-            assert_eq!(_20, NumCast::from(20i16).unwrap());
-            assert_eq!(_20, NumCast::from(20i32).unwrap());
-            assert_eq!(_20, NumCast::from(20i64).unwrap());
-            assert_eq!(_20, NumCast::from(20f32).unwrap());
-            assert_eq!(_20, NumCast::from(20f64).unwrap());
-
-            assert_eq!(_20, cast(20usize).unwrap());
-            assert_eq!(_20, cast(20u8).unwrap());
-            assert_eq!(_20, cast(20u16).unwrap());
-            assert_eq!(_20, cast(20u32).unwrap());
-            assert_eq!(_20, cast(20u64).unwrap());
-            assert_eq!(_20, cast(20).unwrap());
-            assert_eq!(_20, cast(20i8).unwrap());
-            assert_eq!(_20, cast(20i16).unwrap());
-            assert_eq!(_20, cast(20i32).unwrap());
-            assert_eq!(_20, cast(20i64).unwrap());
-            assert_eq!(_20, cast(20f32).unwrap());
-            assert_eq!(_20, cast(20f64).unwrap());
-        })
-    }
-
-    #[test] fn test_u8_cast()    { test_cast_20!(20u8)    }
-    #[test] fn test_u16_cast()   { test_cast_20!(20u16)   }
-    #[test] fn test_u32_cast()   { test_cast_20!(20u32)   }
-    #[test] fn test_u64_cast()   { test_cast_20!(20u64)   }
-    #[test] fn test_uint_cast()  { test_cast_20!(20usize) }
-    #[test] fn test_i8_cast()    { test_cast_20!(20i8)    }
-    #[test] fn test_i16_cast()   { test_cast_20!(20i16)   }
-    #[test] fn test_i32_cast()   { test_cast_20!(20i32)   }
-    #[test] fn test_i64_cast()   { test_cast_20!(20i64)   }
-    #[test] fn test_int_cast()   { test_cast_20!(20)      }
-    #[test] fn test_f32_cast()   { test_cast_20!(20f32)   }
-    #[test] fn test_f64_cast()   { test_cast_20!(20f64)   }
-
-    #[test]
-    fn test_cast_range_int_min() {
-        assert_eq!(isize::MIN.to_int(),  Some(isize::MIN as isize));
-        assert_eq!(isize::MIN.to_i8(),   None);
-        assert_eq!(isize::MIN.to_i16(),  None);
-        // isize::MIN.to_i32() is word-size specific
-        assert_eq!(isize::MIN.to_i64(),  Some(isize::MIN as i64));
-        assert_eq!(isize::MIN.to_uint(), None);
-        assert_eq!(isize::MIN.to_u8(),   None);
-        assert_eq!(isize::MIN.to_u16(),  None);
-        assert_eq!(isize::MIN.to_u32(),  None);
-        assert_eq!(isize::MIN.to_u64(),  None);
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(isize::MIN.to_i32(), Some(isize::MIN as i32));
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(isize::MIN.to_i32(), None);
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_i8_min() {
-        assert_eq!(i8::MIN.to_int(),  Some(i8::MIN as isize));
-        assert_eq!(i8::MIN.to_i8(),   Some(i8::MIN as i8));
-        assert_eq!(i8::MIN.to_i16(),  Some(i8::MIN as i16));
-        assert_eq!(i8::MIN.to_i32(),  Some(i8::MIN as i32));
-        assert_eq!(i8::MIN.to_i64(),  Some(i8::MIN as i64));
-        assert_eq!(i8::MIN.to_uint(), None);
-        assert_eq!(i8::MIN.to_u8(),   None);
-        assert_eq!(i8::MIN.to_u16(),  None);
-        assert_eq!(i8::MIN.to_u32(),  None);
-        assert_eq!(i8::MIN.to_u64(),  None);
-    }
-
-    #[test]
-    fn test_cast_range_i16_min() {
-        assert_eq!(i16::MIN.to_int(),  Some(i16::MIN as isize));
-        assert_eq!(i16::MIN.to_i8(),   None);
-        assert_eq!(i16::MIN.to_i16(),  Some(i16::MIN as i16));
-        assert_eq!(i16::MIN.to_i32(),  Some(i16::MIN as i32));
-        assert_eq!(i16::MIN.to_i64(),  Some(i16::MIN as i64));
-        assert_eq!(i16::MIN.to_uint(), None);
-        assert_eq!(i16::MIN.to_u8(),   None);
-        assert_eq!(i16::MIN.to_u16(),  None);
-        assert_eq!(i16::MIN.to_u32(),  None);
-        assert_eq!(i16::MIN.to_u64(),  None);
-    }
-
-    #[test]
-    fn test_cast_range_i32_min() {
-        assert_eq!(i32::MIN.to_int(),  Some(i32::MIN as isize));
-        assert_eq!(i32::MIN.to_i8(),   None);
-        assert_eq!(i32::MIN.to_i16(),  None);
-        assert_eq!(i32::MIN.to_i32(),  Some(i32::MIN as i32));
-        assert_eq!(i32::MIN.to_i64(),  Some(i32::MIN as i64));
-        assert_eq!(i32::MIN.to_uint(), None);
-        assert_eq!(i32::MIN.to_u8(),   None);
-        assert_eq!(i32::MIN.to_u16(),  None);
-        assert_eq!(i32::MIN.to_u32(),  None);
-        assert_eq!(i32::MIN.to_u64(),  None);
-    }
-
-    #[test]
-    fn test_cast_range_i64_min() {
-        // i64::MIN.to_int() is word-size specific
-        assert_eq!(i64::MIN.to_i8(),   None);
-        assert_eq!(i64::MIN.to_i16(),  None);
-        assert_eq!(i64::MIN.to_i32(),  None);
-        assert_eq!(i64::MIN.to_i64(),  Some(i64::MIN as i64));
-        assert_eq!(i64::MIN.to_uint(), None);
-        assert_eq!(i64::MIN.to_u8(),   None);
-        assert_eq!(i64::MIN.to_u16(),  None);
-        assert_eq!(i64::MIN.to_u32(),  None);
-        assert_eq!(i64::MIN.to_u64(),  None);
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(i64::MIN.to_int(), None);
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(i64::MIN.to_int(), Some(i64::MIN as isize));
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_int_max() {
-        assert_eq!(isize::MAX.to_int(),  Some(isize::MAX as isize));
-        assert_eq!(isize::MAX.to_i8(),   None);
-        assert_eq!(isize::MAX.to_i16(),  None);
-        // isize::MAX.to_i32() is word-size specific
-        assert_eq!(isize::MAX.to_i64(),  Some(isize::MAX as i64));
-        assert_eq!(isize::MAX.to_u8(),   None);
-        assert_eq!(isize::MAX.to_u16(),  None);
-        // isize::MAX.to_u32() is word-size specific
-        assert_eq!(isize::MAX.to_u64(),  Some(isize::MAX as u64));
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(isize::MAX.to_i32(), Some(isize::MAX as i32));
-            assert_eq!(isize::MAX.to_u32(), Some(isize::MAX as u32));
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(isize::MAX.to_i32(), None);
-            assert_eq!(isize::MAX.to_u32(), None);
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_i8_max() {
-        assert_eq!(i8::MAX.to_int(),  Some(i8::MAX as isize));
-        assert_eq!(i8::MAX.to_i8(),   Some(i8::MAX as i8));
-        assert_eq!(i8::MAX.to_i16(),  Some(i8::MAX as i16));
-        assert_eq!(i8::MAX.to_i32(),  Some(i8::MAX as i32));
-        assert_eq!(i8::MAX.to_i64(),  Some(i8::MAX as i64));
-        assert_eq!(i8::MAX.to_uint(), Some(i8::MAX as usize));
-        assert_eq!(i8::MAX.to_u8(),   Some(i8::MAX as u8));
-        assert_eq!(i8::MAX.to_u16(),  Some(i8::MAX as u16));
-        assert_eq!(i8::MAX.to_u32(),  Some(i8::MAX as u32));
-        assert_eq!(i8::MAX.to_u64(),  Some(i8::MAX as u64));
-    }
-
-    #[test]
-    fn test_cast_range_i16_max() {
-        assert_eq!(i16::MAX.to_int(),  Some(i16::MAX as isize));
-        assert_eq!(i16::MAX.to_i8(),   None);
-        assert_eq!(i16::MAX.to_i16(),  Some(i16::MAX as i16));
-        assert_eq!(i16::MAX.to_i32(),  Some(i16::MAX as i32));
-        assert_eq!(i16::MAX.to_i64(),  Some(i16::MAX as i64));
-        assert_eq!(i16::MAX.to_uint(), Some(i16::MAX as usize));
-        assert_eq!(i16::MAX.to_u8(),   None);
-        assert_eq!(i16::MAX.to_u16(),  Some(i16::MAX as u16));
-        assert_eq!(i16::MAX.to_u32(),  Some(i16::MAX as u32));
-        assert_eq!(i16::MAX.to_u64(),  Some(i16::MAX as u64));
-    }
-
-    #[test]
-    fn test_cast_range_i32_max() {
-        assert_eq!(i32::MAX.to_int(),  Some(i32::MAX as isize));
-        assert_eq!(i32::MAX.to_i8(),   None);
-        assert_eq!(i32::MAX.to_i16(),  None);
-        assert_eq!(i32::MAX.to_i32(),  Some(i32::MAX as i32));
-        assert_eq!(i32::MAX.to_i64(),  Some(i32::MAX as i64));
-        assert_eq!(i32::MAX.to_uint(), Some(i32::MAX as usize));
-        assert_eq!(i32::MAX.to_u8(),   None);
-        assert_eq!(i32::MAX.to_u16(),  None);
-        assert_eq!(i32::MAX.to_u32(),  Some(i32::MAX as u32));
-        assert_eq!(i32::MAX.to_u64(),  Some(i32::MAX as u64));
-    }
-
-    #[test]
-    fn test_cast_range_i64_max() {
-        // i64::MAX.to_int() is word-size specific
-        assert_eq!(i64::MAX.to_i8(),   None);
-        assert_eq!(i64::MAX.to_i16(),  None);
-        assert_eq!(i64::MAX.to_i32(),  None);
-        assert_eq!(i64::MAX.to_i64(),  Some(i64::MAX as i64));
-        // i64::MAX.to_uint() is word-size specific
-        assert_eq!(i64::MAX.to_u8(),   None);
-        assert_eq!(i64::MAX.to_u16(),  None);
-        assert_eq!(i64::MAX.to_u32(),  None);
-        assert_eq!(i64::MAX.to_u64(),  Some(i64::MAX as u64));
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(i64::MAX.to_int(),  None);
-            assert_eq!(i64::MAX.to_uint(), None);
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(i64::MAX.to_int(),  Some(i64::MAX as isize));
-            assert_eq!(i64::MAX.to_uint(), Some(i64::MAX as usize));
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_uint_min() {
-        assert_eq!(usize::MIN.to_int(),  Some(usize::MIN as isize));
-        assert_eq!(usize::MIN.to_i8(),   Some(usize::MIN as i8));
-        assert_eq!(usize::MIN.to_i16(),  Some(usize::MIN as i16));
-        assert_eq!(usize::MIN.to_i32(),  Some(usize::MIN as i32));
-        assert_eq!(usize::MIN.to_i64(),  Some(usize::MIN as i64));
-        assert_eq!(usize::MIN.to_uint(), Some(usize::MIN as usize));
-        assert_eq!(usize::MIN.to_u8(),   Some(usize::MIN as u8));
-        assert_eq!(usize::MIN.to_u16(),  Some(usize::MIN as u16));
-        assert_eq!(usize::MIN.to_u32(),  Some(usize::MIN as u32));
-        assert_eq!(usize::MIN.to_u64(),  Some(usize::MIN as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u8_min() {
-        assert_eq!(u8::MIN.to_int(),  Some(u8::MIN as isize));
-        assert_eq!(u8::MIN.to_i8(),   Some(u8::MIN as i8));
-        assert_eq!(u8::MIN.to_i16(),  Some(u8::MIN as i16));
-        assert_eq!(u8::MIN.to_i32(),  Some(u8::MIN as i32));
-        assert_eq!(u8::MIN.to_i64(),  Some(u8::MIN as i64));
-        assert_eq!(u8::MIN.to_uint(), Some(u8::MIN as usize));
-        assert_eq!(u8::MIN.to_u8(),   Some(u8::MIN as u8));
-        assert_eq!(u8::MIN.to_u16(),  Some(u8::MIN as u16));
-        assert_eq!(u8::MIN.to_u32(),  Some(u8::MIN as u32));
-        assert_eq!(u8::MIN.to_u64(),  Some(u8::MIN as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u16_min() {
-        assert_eq!(u16::MIN.to_int(),  Some(u16::MIN as isize));
-        assert_eq!(u16::MIN.to_i8(),   Some(u16::MIN as i8));
-        assert_eq!(u16::MIN.to_i16(),  Some(u16::MIN as i16));
-        assert_eq!(u16::MIN.to_i32(),  Some(u16::MIN as i32));
-        assert_eq!(u16::MIN.to_i64(),  Some(u16::MIN as i64));
-        assert_eq!(u16::MIN.to_uint(), Some(u16::MIN as usize));
-        assert_eq!(u16::MIN.to_u8(),   Some(u16::MIN as u8));
-        assert_eq!(u16::MIN.to_u16(),  Some(u16::MIN as u16));
-        assert_eq!(u16::MIN.to_u32(),  Some(u16::MIN as u32));
-        assert_eq!(u16::MIN.to_u64(),  Some(u16::MIN as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u32_min() {
-        assert_eq!(u32::MIN.to_int(),  Some(u32::MIN as isize));
-        assert_eq!(u32::MIN.to_i8(),   Some(u32::MIN as i8));
-        assert_eq!(u32::MIN.to_i16(),  Some(u32::MIN as i16));
-        assert_eq!(u32::MIN.to_i32(),  Some(u32::MIN as i32));
-        assert_eq!(u32::MIN.to_i64(),  Some(u32::MIN as i64));
-        assert_eq!(u32::MIN.to_uint(), Some(u32::MIN as usize));
-        assert_eq!(u32::MIN.to_u8(),   Some(u32::MIN as u8));
-        assert_eq!(u32::MIN.to_u16(),  Some(u32::MIN as u16));
-        assert_eq!(u32::MIN.to_u32(),  Some(u32::MIN as u32));
-        assert_eq!(u32::MIN.to_u64(),  Some(u32::MIN as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u64_min() {
-        assert_eq!(u64::MIN.to_int(),  Some(u64::MIN as isize));
-        assert_eq!(u64::MIN.to_i8(),   Some(u64::MIN as i8));
-        assert_eq!(u64::MIN.to_i16(),  Some(u64::MIN as i16));
-        assert_eq!(u64::MIN.to_i32(),  Some(u64::MIN as i32));
-        assert_eq!(u64::MIN.to_i64(),  Some(u64::MIN as i64));
-        assert_eq!(u64::MIN.to_uint(), Some(u64::MIN as usize));
-        assert_eq!(u64::MIN.to_u8(),   Some(u64::MIN as u8));
-        assert_eq!(u64::MIN.to_u16(),  Some(u64::MIN as u16));
-        assert_eq!(u64::MIN.to_u32(),  Some(u64::MIN as u32));
-        assert_eq!(u64::MIN.to_u64(),  Some(u64::MIN as u64));
-    }
-
-    #[test]
-    fn test_cast_range_uint_max() {
-        assert_eq!(usize::MAX.to_int(),  None);
-        assert_eq!(usize::MAX.to_i8(),   None);
-        assert_eq!(usize::MAX.to_i16(),  None);
-        assert_eq!(usize::MAX.to_i32(),  None);
-        // usize::MAX.to_i64() is word-size specific
-        assert_eq!(usize::MAX.to_u8(),   None);
-        assert_eq!(usize::MAX.to_u16(),  None);
-        // usize::MAX.to_u32() is word-size specific
-        assert_eq!(usize::MAX.to_u64(),  Some(usize::MAX as u64));
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(usize::MAX.to_u32(), Some(usize::MAX as u32));
-            assert_eq!(usize::MAX.to_i64(), Some(usize::MAX as i64));
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(usize::MAX.to_u32(), None);
-            assert_eq!(usize::MAX.to_i64(), None);
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_u8_max() {
-        assert_eq!(u8::MAX.to_int(),  Some(u8::MAX as isize));
-        assert_eq!(u8::MAX.to_i8(),   None);
-        assert_eq!(u8::MAX.to_i16(),  Some(u8::MAX as i16));
-        assert_eq!(u8::MAX.to_i32(),  Some(u8::MAX as i32));
-        assert_eq!(u8::MAX.to_i64(),  Some(u8::MAX as i64));
-        assert_eq!(u8::MAX.to_uint(), Some(u8::MAX as usize));
-        assert_eq!(u8::MAX.to_u8(),   Some(u8::MAX as u8));
-        assert_eq!(u8::MAX.to_u16(),  Some(u8::MAX as u16));
-        assert_eq!(u8::MAX.to_u32(),  Some(u8::MAX as u32));
-        assert_eq!(u8::MAX.to_u64(),  Some(u8::MAX as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u16_max() {
-        assert_eq!(u16::MAX.to_int(),  Some(u16::MAX as isize));
-        assert_eq!(u16::MAX.to_i8(),   None);
-        assert_eq!(u16::MAX.to_i16(),  None);
-        assert_eq!(u16::MAX.to_i32(),  Some(u16::MAX as i32));
-        assert_eq!(u16::MAX.to_i64(),  Some(u16::MAX as i64));
-        assert_eq!(u16::MAX.to_uint(), Some(u16::MAX as usize));
-        assert_eq!(u16::MAX.to_u8(),   None);
-        assert_eq!(u16::MAX.to_u16(),  Some(u16::MAX as u16));
-        assert_eq!(u16::MAX.to_u32(),  Some(u16::MAX as u32));
-        assert_eq!(u16::MAX.to_u64(),  Some(u16::MAX as u64));
-    }
-
-    #[test]
-    fn test_cast_range_u32_max() {
-        // u32::MAX.to_int() is word-size specific
-        assert_eq!(u32::MAX.to_i8(),   None);
-        assert_eq!(u32::MAX.to_i16(),  None);
-        assert_eq!(u32::MAX.to_i32(),  None);
-        assert_eq!(u32::MAX.to_i64(),  Some(u32::MAX as i64));
-        assert_eq!(u32::MAX.to_uint(), Some(u32::MAX as usize));
-        assert_eq!(u32::MAX.to_u8(),   None);
-        assert_eq!(u32::MAX.to_u16(),  None);
-        assert_eq!(u32::MAX.to_u32(),  Some(u32::MAX as u32));
-        assert_eq!(u32::MAX.to_u64(),  Some(u32::MAX as u64));
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(u32::MAX.to_int(),  None);
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(u32::MAX.to_int(),  Some(u32::MAX as isize));
-        }
-
-        check_word_size();
-    }
-
-    #[test]
-    fn test_cast_range_u64_max() {
-        assert_eq!(u64::MAX.to_int(),  None);
-        assert_eq!(u64::MAX.to_i8(),   None);
-        assert_eq!(u64::MAX.to_i16(),  None);
-        assert_eq!(u64::MAX.to_i32(),  None);
-        assert_eq!(u64::MAX.to_i64(),  None);
-        // u64::MAX.to_uint() is word-size specific
-        assert_eq!(u64::MAX.to_u8(),   None);
-        assert_eq!(u64::MAX.to_u16(),  None);
-        assert_eq!(u64::MAX.to_u32(),  None);
-        assert_eq!(u64::MAX.to_u64(),  Some(u64::MAX as u64));
-
-        #[cfg(target_pointer_width = "32")]
-        fn check_word_size() {
-            assert_eq!(u64::MAX.to_uint(), None);
-        }
-
-        #[cfg(target_pointer_width = "64")]
-        fn check_word_size() {
-            assert_eq!(u64::MAX.to_uint(), Some(u64::MAX as usize));
-        }
-
-        check_word_size();
-    }
+    use ops::Mul;
 
     #[test]
     fn test_saturating_add_uint() {
@@ -507,23 +106,23 @@ mod tests {
     #[test]
     fn test_saturating_add_int() {
         use isize::{MIN,MAX};
-        assert_eq!(3.saturating_add(5), 8);
-        assert_eq!(3.saturating_add(MAX-1), MAX);
+        assert_eq!(3i32.saturating_add(5), 8);
+        assert_eq!(3isize.saturating_add(MAX-1), MAX);
         assert_eq!(MAX.saturating_add(MAX), MAX);
         assert_eq!((MAX-2).saturating_add(1), MAX-1);
-        assert_eq!(3.saturating_add(-5), -2);
+        assert_eq!(3i32.saturating_add(-5), -2);
         assert_eq!(MIN.saturating_add(-1), MIN);
-        assert_eq!((-2).saturating_add(-MAX), MIN);
+        assert_eq!((-2isize).saturating_add(-MAX), MIN);
     }
 
     #[test]
     fn test_saturating_sub_int() {
         use isize::{MIN,MAX};
-        assert_eq!(3.saturating_sub(5), -2);
+        assert_eq!(3i32.saturating_sub(5), -2);
         assert_eq!(MIN.saturating_sub(1), MIN);
-        assert_eq!((-2).saturating_sub(MAX), MIN);
-        assert_eq!(3.saturating_sub(-5), 8);
-        assert_eq!(3.saturating_sub(-(MAX-1)), MAX);
+        assert_eq!((-2isize).saturating_sub(MAX), MIN);
+        assert_eq!(3i32.saturating_sub(-5), 8);
+        assert_eq!(3isize.saturating_sub(-(MAX-1)), MAX);
         assert_eq!(MAX.saturating_sub(-MAX), MAX);
         assert_eq!((MAX-2).saturating_sub(-1), MAX-1);
     }
@@ -627,56 +226,10 @@ mod tests {
     test_checked_next_power_of_two! { test_checked_next_power_of_two_u64, u64 }
     test_checked_next_power_of_two! { test_checked_next_power_of_two_uint, usize }
 
-    #[derive(PartialEq, Debug)]
-    struct Value { x: isize }
-
-    impl ToPrimitive for Value {
-        fn to_i64(&self) -> Option<i64> { self.x.to_i64() }
-        fn to_u64(&self) -> Option<u64> { self.x.to_u64() }
-    }
-
-    impl FromPrimitive for Value {
-        fn from_i64(n: i64) -> Option<Value> { Some(Value { x: n as isize }) }
-        fn from_u64(n: u64) -> Option<Value> { Some(Value { x: n as isize }) }
-    }
-
-    #[test]
-    fn test_to_primitive() {
-        let value = Value { x: 5 };
-        assert_eq!(value.to_int(),  Some(5));
-        assert_eq!(value.to_i8(),   Some(5));
-        assert_eq!(value.to_i16(),  Some(5));
-        assert_eq!(value.to_i32(),  Some(5));
-        assert_eq!(value.to_i64(),  Some(5));
-        assert_eq!(value.to_uint(), Some(5));
-        assert_eq!(value.to_u8(),   Some(5));
-        assert_eq!(value.to_u16(),  Some(5));
-        assert_eq!(value.to_u32(),  Some(5));
-        assert_eq!(value.to_u64(),  Some(5));
-        assert_eq!(value.to_f32(),  Some(5f32));
-        assert_eq!(value.to_f64(),  Some(5f64));
-    }
-
-    #[test]
-    fn test_from_primitive() {
-        assert_eq!(from_int(5),    Some(Value { x: 5 }));
-        assert_eq!(from_i8(5),     Some(Value { x: 5 }));
-        assert_eq!(from_i16(5),    Some(Value { x: 5 }));
-        assert_eq!(from_i32(5),    Some(Value { x: 5 }));
-        assert_eq!(from_i64(5),    Some(Value { x: 5 }));
-        assert_eq!(from_uint(5),   Some(Value { x: 5 }));
-        assert_eq!(from_u8(5),     Some(Value { x: 5 }));
-        assert_eq!(from_u16(5),    Some(Value { x: 5 }));
-        assert_eq!(from_u32(5),    Some(Value { x: 5 }));
-        assert_eq!(from_u64(5),    Some(Value { x: 5 }));
-        assert_eq!(from_f32(5f32), Some(Value { x: 5 }));
-        assert_eq!(from_f64(5f64), Some(Value { x: 5 }));
-    }
-
     #[test]
     fn test_pow() {
-        fn naive_pow<T: Int>(base: T, exp: usize) -> T {
-            let one: T = Int::one();
+        fn naive_pow<T: Mul<Output=T> + One + Copy>(base: T, exp: usize) -> T {
+            let one: T = T::one();
             (0..exp).fold(one, |acc, _| acc * base)
         }
         macro_rules! assert_pow {
@@ -686,11 +239,11 @@ mod tests {
                 assert_eq!(result, naive_pow($num, $exp));
             }}
         }
-        assert_pow!((3,     0 ) => 1);
-        assert_pow!((5,     1 ) => 5);
-        assert_pow!((-4,    2 ) => 16);
-        assert_pow!((8,     3 ) => 512);
-        assert_pow!((2u64,   50) => 1125899906842624);
+        assert_pow!((3u32,     0 ) => 1);
+        assert_pow!((5u32,     1 ) => 5);
+        assert_pow!((-4i32,    2 ) => 16);
+        assert_pow!((8u32,     3 ) => 512);
+        assert_pow!((2u64,     50) => 1125899906842624);
     }
 
     #[test]
@@ -765,12 +318,11 @@ mod tests {
 mod bench {
     extern crate test;
     use self::test::Bencher;
-    use num::Int;
     use prelude::v1::*;
 
     #[bench]
     fn bench_pow_function(b: &mut Bencher) {
-        let v = (0..1024).collect::<Vec<_>>();
-        b.iter(|| {v.iter().fold(0, |old, new| old.pow(*new as u32));});
+        let v = (0..1024).collect::<Vec<u32>>();
+        b.iter(|| {v.iter().fold(0u32, |old, new| old.pow(*new as u32));});
     }
 }
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index c9e6a8f66d1..96b0ba1c77f 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -12,12 +12,11 @@
 #![doc(hidden)]
 #![allow(unsigned_negation)]
 
-macro_rules! uint_module { ($T:ty) => (
+macro_rules! uint_module { ($T:ident) => (
 
 #[cfg(test)]
 mod tests {
     use prelude::v1::*;
-    use num::FromStrRadix;
 
     fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> {
         ::str::FromStr::from_str(t).ok()
@@ -38,15 +37,15 @@ mod tests {
 
     #[test]
     pub fn test_parse_bytes() {
-        assert_eq!(FromStrRadix::from_str_radix("123", 10), Ok(123 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("1001", 2), Ok(9 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("123", 8), Ok(83 as $T));
-        assert_eq!(FromStrRadix::from_str_radix("123", 16), Ok(291 as u16));
-        assert_eq!(FromStrRadix::from_str_radix("ffff", 16), Ok(65535 as u16));
-        assert_eq!(FromStrRadix::from_str_radix("z", 36), Ok(35 as $T));
-
-        assert_eq!(FromStrRadix::from_str_radix("Z", 10).ok(), None::<$T>);
-        assert_eq!(FromStrRadix::from_str_radix("_", 2).ok(), None::<$T>);
+        assert_eq!($T::from_str_radix("123", 10), Ok(123 as $T));
+        assert_eq!($T::from_str_radix("1001", 2), Ok(9 as $T));
+        assert_eq!($T::from_str_radix("123", 8), Ok(83 as $T));
+        assert_eq!(u16::from_str_radix("123", 16), Ok(291 as u16));
+        assert_eq!(u16::from_str_radix("ffff", 16), Ok(65535 as u16));
+        assert_eq!($T::from_str_radix("z", 36), Ok(35 as $T));
+
+        assert_eq!($T::from_str_radix("Z", 10).ok(), None::<$T>);
+        assert_eq!($T::from_str_radix("_", 2).ok(), None::<$T>);
     }
 }
 
diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs
index f8dd6a00c7f..2837bac4456 100644
--- a/src/libstd/rand/reader.rs
+++ b/src/libstd/rand/reader.rs
@@ -67,7 +67,6 @@ mod test {
     use prelude::v1::*;
 
     use super::ReaderRng;
-    use num::Int;
     use rand::Rng;
 
     #[test]
@@ -78,18 +77,18 @@ mod test {
                   0,   0, 0, 0, 0, 0, 0, 3][..];
         let mut rng = ReaderRng::new(v);
 
-        assert_eq!(rng.next_u64(), 1.to_be());
-        assert_eq!(rng.next_u64(), 2.to_be());
-        assert_eq!(rng.next_u64(), 3.to_be());
+        assert_eq!(rng.next_u64(), 1u64.to_be());
+        assert_eq!(rng.next_u64(), 2u64.to_be());
+        assert_eq!(rng.next_u64(), 3u64.to_be());
     }
     #[test]
     fn test_reader_rng_u32() {
         let v = &[0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3][..];
         let mut rng = ReaderRng::new(v);
 
-        assert_eq!(rng.next_u32(), 1.to_be());
-        assert_eq!(rng.next_u32(), 2.to_be());
-        assert_eq!(rng.next_u32(), 3.to_be());
+        assert_eq!(rng.next_u32(), 1u32.to_be());
+        assert_eq!(rng.next_u32(), 2u32.to_be());
+        assert_eq!(rng.next_u32(), 3u32.to_be());
     }
     #[test]
     fn test_reader_rng_fill_bytes() {
diff --git a/src/libstd/sys/windows/fs2.rs b/src/libstd/sys/windows/fs2.rs
index b0515a71229..a9ab73feed8 100644
--- a/src/libstd/sys/windows/fs2.rs
+++ b/src/libstd/sys/windows/fs2.rs
@@ -13,7 +13,7 @@ use io::prelude::*;
 use os::windows::prelude::*;
 
 use default::Default;
-use ffi::{OsString, AsOsStr};
+use ffi::OsString;
 use fmt;
 use io::{self, Error, SeekFrom};
 use libc::{self, HANDLE};
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index 1171c6c068b..5ae5f6f201b 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -17,8 +17,7 @@ use prelude::v1::*;
 use ffi::{OsStr, OsString};
 use io::{self, ErrorKind};
 use libc;
-#[allow(deprecated)]
-use num::Int;
+use num::Zero;
 use os::windows::ffi::{OsStrExt, OsStringExt};
 use path::PathBuf;
 
@@ -144,9 +143,8 @@ pub fn truncate_utf16_at_nul<'a>(v: &'a [u16]) -> &'a [u16] {
     }
 }
 
-#[allow(deprecated)]
-fn cvt<I: Int>(i: I) -> io::Result<I> {
-    if i == Int::zero() {
+fn cvt<I: PartialEq + Zero>(i: I) -> io::Result<I> {
+    if i == I::zero() {
         Err(io::Error::last_os_error())
     } else {
         Ok(i)
diff --git a/src/libstd/sys/windows/net.rs b/src/libstd/sys/windows/net.rs
index cbc3876dbb1..6bbcd968157 100644
--- a/src/libstd/sys/windows/net.rs
+++ b/src/libstd/sys/windows/net.rs
@@ -15,8 +15,8 @@ use libc::consts::os::extra::INVALID_SOCKET;
 use libc::{self, c_int, c_void};
 use mem;
 use net::SocketAddr;
-#[allow(deprecated)]
-use num::{SignedInt, Int};
+use num::One;
+use ops::Neg;
 use rt;
 use sync::{Once, ONCE_INIT};
 use sys::c;
@@ -49,11 +49,8 @@ fn last_error() -> io::Error {
 /// Checks if the signed integer is the Windows constant `SOCKET_ERROR` (-1)
 /// and if so, returns the last error from the Windows socket interface. . This
 /// function must be called before another call to the socket API is made.
-///
-/// FIXME: generics needed?
-#[allow(deprecated)]
-pub fn cvt<T: SignedInt>(t: T) -> io::Result<T> {
-    let one: T = Int::one();
+pub fn cvt<T: One + Neg<Output=T> + PartialEq>(t: T) -> io::Result<T> {
+    let one: T = T::one();
     if t == -one {
         Err(last_error())
     } else {
@@ -70,7 +67,9 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
 
 /// Provides the functionality of `cvt` for a closure.
 #[allow(deprecated)]
-pub fn cvt_r<T: SignedInt, F>(mut f: F) -> io::Result<T> where F: FnMut() -> T {
+pub fn cvt_r<T, F>(mut f: F) -> io::Result<T>
+    where F: FnMut() -> T, T: One + Neg<Output=T> + PartialEq
+{
     cvt(f())
 }
 
diff --git a/src/libstd/sys/windows/process2.rs b/src/libstd/sys/windows/process2.rs
index 16c2a9125ea..5ddcf3d1ea2 100644
--- a/src/libstd/sys/windows/process2.rs
+++ b/src/libstd/sys/windows/process2.rs
@@ -140,7 +140,7 @@ impl Process {
         // read the *child's* PATH if one is provided. See #15149 for more details.
         let program = cfg.env.as_ref().and_then(|env| {
             for (key, v) in env {
-                if OsStr::from_str("PATH") != &**key { continue }
+                if OsStr::new("PATH") != &**key { continue }
 
                 // Split the value and test each path to see if the
                 // program exists.
@@ -463,7 +463,7 @@ mod tests {
     fn test_make_command_line() {
         fn test_wrapper(prog: &str, args: &[&str]) -> String {
             String::from_utf16(
-                &make_command_line(OsStr::from_str(prog),
+                &make_command_line(OsStr::new(prog),
                                    &args.iter()
                                         .map(|a| OsString::from(a))
                                         .collect::<Vec<OsString>>())).unwrap()
diff --git a/src/libtest/stats.rs b/src/libtest/stats.rs
index 341be762601..c1ba1260f67 100644
--- a/src/libtest/stats.rs
+++ b/src/libtest/stats.rs
@@ -338,14 +338,13 @@ mod tests {
 
     macro_rules! assert_approx_eq {
         ($a:expr, $b:expr) => ({
-            use std::num::Float;
             let (a, b) = (&$a, &$b);
             assert!((*a - *b).abs() < 1.0e-6,
                     "{} is not approximately equal to {}", *a, *b);
         })
     }
 
-    fn check(samples: &[f64], summ: &Summary<f64>) {
+    fn check(samples: &[f64], summ: &Summary) {
 
         let summ2 = Summary::new(samples);
 
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs
index 530c499f5fd..efbb5dfb549 100644
--- a/src/test/bench/noise.rs
+++ b/src/test/bench/noise.rs
@@ -14,7 +14,6 @@
 #![feature(rand, core)]
 
 use std::f32::consts::PI;
-use std::num::Float;
 use std::__rand::{Rng, thread_rng};
 
 #[derive(Copy, Clone)]
diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs
index 61fe6593dc3..c576eea3602 100644
--- a/src/test/bench/shootout-binarytrees.rs
+++ b/src/test/bench/shootout-binarytrees.rs
@@ -109,8 +109,7 @@ fn main() {
     let long_lived_tree = bottom_up_tree(&long_lived_arena, 0, max_depth);
 
     let messages = (min_depth..max_depth + 1).step_by(2).map(|depth| {
-        use std::num::Int;
-        let iterations = 2.pow((max_depth - depth + min_depth) as u32);
+        let iterations = 2i32.pow((max_depth - depth + min_depth) as u32);
         thread::spawn(move || inner(depth, iterations))
     }).collect::<Vec<_>>();
 
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 0474cfb6fc8..accf525b4e6 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -43,7 +43,6 @@ use std::env;
 use std::fs::File;
 use std::io::{self, BufWriter};
 use std::io::prelude::*;
-use std::num::Float;
 
 const LINE_LENGTH: usize = 60;
 const IM: u32 = 139968;
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index de7fb737958..368dbbb931c 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -38,9 +38,7 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 // OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#![feature(core)]
-
-use std::num::Float;
+use std::mem;
 
 const PI: f64 = 3.141592653589793;
 const SOLAR_MASS: f64 = 4.0 * PI * PI;
@@ -193,16 +191,9 @@ fn main() {
 /// longer contain the mutable reference. This is a safe operation because the
 /// two mutable borrows are entirely disjoint.
 fn shift_mut_ref<'a, T>(r: &mut &'a mut [T]) -> Option<&'a mut T> {
-    use std::mem;
-    use std::raw::Repr;
-
-    if r.is_empty() { return None }
-    unsafe {
-        let mut raw = r.repr();
-        let ret = raw.data as *mut T;
-        raw.data = raw.data.offset(1);
-        raw.len -= 1;
-        *r = mem::transmute(raw);
-        Some({ &mut *ret })
-    }
+    let res = mem::replace(r, &mut []);
+    if res.is_empty() { return None }
+    let (a, b) = res.split_at_mut(1);
+    *r = b;
+    Some(&mut a[0])
 }
diff --git a/src/test/bench/shootout-spectralnorm.rs b/src/test/bench/shootout-spectralnorm.rs
index b0e8c395673..0fa22abde3c 100644
--- a/src/test/bench/shootout-spectralnorm.rs
+++ b/src/test/bench/shootout-spectralnorm.rs
@@ -46,7 +46,6 @@
 use std::iter::repeat;
 use std::thread;
 use std::mem;
-use std::num::Float;
 use std::os;
 use std::env;
 use std::raw::Repr;
diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs
index 3913de3a3f9..16742f0a6e1 100644
--- a/src/test/bench/sudoku.rs
+++ b/src/test/bench/sudoku.rs
@@ -16,7 +16,6 @@
 use std::io::prelude::*;
 use std::io;
 use std::iter::repeat;
-use std::num::Int;
 use std::env;
 
 // Computes a single solution to a given 9x9 sudoku
diff --git a/src/test/pretty/default-trait-impl.rs b/src/test/pretty/default-trait-impl.rs
index 509bee9def2..a5246b9300c 100644
--- a/src/test/pretty/default-trait-impl.rs
+++ b/src/test/pretty/default-trait-impl.rs
@@ -8,13 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-#![feature(optin_builtin_traits, core)]
+#![feature(optin_builtin_traits)]
 
 // pp-exact
 
-use std::marker::MarkerTrait;
-
-trait MyTrait: MarkerTrait { }
+trait MyTrait { }
 
 impl MyTrait for .. { }