diff options
Diffstat (limited to 'src/libcore/num/mod.rs')
| -rw-r--r-- | src/libcore/num/mod.rs | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 3fd179cf86f..9b1a384a0d0 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -268,7 +268,7 @@ pub trait Int #[stable(feature = "rust1", since = "1.0.0")] fn swap_bytes(self) -> Self; - /// Convert an integer from big endian to the target's endianness. + /// Converts an integer from big endian to the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are swapped. /// @@ -291,7 +291,7 @@ pub trait Int if cfg!(target_endian = "big") { x } else { x.swap_bytes() } } - /// Convert an integer from little endian to the target's endianness. + /// Converts an integer from little endian to the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are swapped. /// @@ -314,7 +314,7 @@ pub trait Int if cfg!(target_endian = "little") { x } else { x.swap_bytes() } } - /// Convert `self` to big endian from the target's endianness. + /// Converts `self` to big endian from the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are swapped. /// @@ -337,7 +337,7 @@ pub trait Int if cfg!(target_endian = "big") { self } else { self.swap_bytes() } } - /// Convert `self` to little endian from the target's endianness. + /// Converts `self` to little endian from the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are swapped. /// @@ -845,7 +845,7 @@ macro_rules! int_impl { let min: $T = Int::min_value(); !min } - /// Convert a string slice in a given base to an integer. + /// Converts a string slice in a given base to an integer. /// /// Leading and trailing whitespace represent an error. /// @@ -995,7 +995,7 @@ macro_rules! int_impl { (self as $UnsignedT).swap_bytes() as $T } - /// Convert an integer from big endian to the target's endianness. + /// Converts an integer from big endian to the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are /// swapped. @@ -1019,7 +1019,7 @@ macro_rules! int_impl { if cfg!(target_endian = "big") { x } else { x.swap_bytes() } } - /// Convert an integer from little endian to the target's endianness. + /// Converts an integer from little endian to the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are /// swapped. @@ -1043,7 +1043,7 @@ macro_rules! int_impl { if cfg!(target_endian = "little") { x } else { x.swap_bytes() } } - /// Convert `self` to big endian from the target's endianness. + /// Converts `self` to big endian from the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are /// swapped. @@ -1067,7 +1067,7 @@ macro_rules! int_impl { if cfg!(target_endian = "big") { self } else { self.swap_bytes() } } - /// Convert `self` to little endian from the target's endianness. + /// Converts `self` to little endian from the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are /// swapped. @@ -1361,7 +1361,7 @@ macro_rules! uint_impl { #[stable(feature = "rust1", since = "1.0.0")] pub fn max_value() -> $T { !0 } - /// Convert a string slice in a given base to an integer. + /// Converts a string slice in a given base to an integer. /// /// Leading and trailing whitespace represent an error. /// @@ -1517,7 +1517,7 @@ macro_rules! uint_impl { unsafe { $bswap(self as $ActualT) as $T } } - /// Convert an integer from big endian to the target's endianness. + /// Converts an integer from big endian to the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are /// swapped. @@ -1541,7 +1541,7 @@ macro_rules! uint_impl { if cfg!(target_endian = "big") { x } else { x.swap_bytes() } } - /// Convert an integer from little endian to the target's endianness. + /// Converts an integer from little endian to the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are /// swapped. @@ -1565,7 +1565,7 @@ macro_rules! uint_impl { if cfg!(target_endian = "little") { x } else { x.swap_bytes() } } - /// Convert `self` to big endian from the target's endianness. + /// Converts `self` to big endian from the target's endianness. /// /// On big endian this is a no-op. On little endian the bytes are /// swapped. @@ -1589,7 +1589,7 @@ macro_rules! uint_impl { if cfg!(target_endian = "big") { self } else { self.swap_bytes() } } - /// Convert `self` to little endian from the target's endianness. + /// Converts `self` to little endian from the target's endianness. /// /// On little endian this is a no-op. On big endian the bytes are /// swapped. @@ -2183,7 +2183,7 @@ impl_to_primitive_float! { f64 } /// A generic trait for converting a number to a value. #[unstable(feature = "core", reason = "trait is likely to be removed")] pub trait FromPrimitive : ::marker::Sized { - /// Convert an `isize` to return an optional value of this type. If the + /// Converts an `isize` to return an optional value of this type. If the /// value cannot be represented by this value, the `None` is returned. #[inline] #[unstable(feature = "core")] @@ -2192,39 +2192,39 @@ pub trait FromPrimitive : ::marker::Sized { FromPrimitive::from_i64(n as i64) } - /// Convert an `isize` to return an optional value of this type. If the + /// Converts an `isize` to return an optional value of this type. If the /// value cannot be represented by this value, the `None` is returned. #[inline] fn from_isize(n: isize) -> Option<Self> { FromPrimitive::from_i64(n as i64) } - /// Convert an `i8` to return an optional value of this type. If the + /// Converts an `i8` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_i8(n: i8) -> Option<Self> { FromPrimitive::from_i64(n as i64) } - /// Convert an `i16` to return an optional value of this type. If the + /// Converts an `i16` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_i16(n: i16) -> Option<Self> { FromPrimitive::from_i64(n as i64) } - /// Convert an `i32` to return an optional value of this type. If the + /// Converts an `i32` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_i32(n: i32) -> Option<Self> { FromPrimitive::from_i64(n as i64) } - /// Convert an `i64` to return an optional value of this type. If the + /// Converts an `i64` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. fn from_i64(n: i64) -> Option<Self>; - /// Convert an `usize` to return an optional value of this type. If the + /// Converts an `usize` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] #[unstable(feature = "core")] @@ -2233,46 +2233,46 @@ pub trait FromPrimitive : ::marker::Sized { FromPrimitive::from_u64(n as u64) } - /// Convert a `usize` to return an optional value of this type. If the + /// Converts a `usize` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_usize(n: usize) -> Option<Self> { FromPrimitive::from_u64(n as u64) } - /// Convert an `u8` to return an optional value of this type. If the + /// Converts an `u8` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_u8(n: u8) -> Option<Self> { FromPrimitive::from_u64(n as u64) } - /// Convert an `u16` to return an optional value of this type. If the + /// Converts an `u16` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_u16(n: u16) -> Option<Self> { FromPrimitive::from_u64(n as u64) } - /// Convert an `u32` to return an optional value of this type. If the + /// Converts an `u32` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_u32(n: u32) -> Option<Self> { FromPrimitive::from_u64(n as u64) } - /// Convert an `u64` to return an optional value of this type. If the + /// Converts an `u64` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. fn from_u64(n: u64) -> Option<Self>; - /// Convert a `f32` to return an optional value of this type. If the + /// Converts a `f32` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_f32(n: f32) -> Option<Self> { FromPrimitive::from_f64(n as f64) } - /// Convert a `f64` to return an optional value of this type. If the + /// Converts a `f64` to return an optional value of this type. If the /// type cannot be represented by this value, the `None` is returned. #[inline] fn from_f64(n: f64) -> Option<Self> { @@ -2401,7 +2401,7 @@ impl_from_primitive! { u64, to_u64 } impl_from_primitive! { f32, to_f32 } impl_from_primitive! { f64, to_f64 } -/// Cast from one machine scalar to another. +/// Casts from one machine scalar to another. /// /// # Examples /// @@ -2583,16 +2583,16 @@ pub trait Float /// Returns the mantissa, exponent and sign as integers, respectively. fn integer_decode(self) -> (u64, i16, i8); - /// Return the largest integer less than or equal to a number. + /// Returns the largest integer less than or equal to a number. fn floor(self) -> Self; - /// Return the smallest integer greater than or equal to a number. + /// Returns the smallest integer greater than or equal to a number. fn ceil(self) -> Self; - /// Return the nearest integer to a number. Round half-way cases away from + /// Returns the nearest integer to a number. Round half-way cases away from /// `0.0`. fn round(self) -> Self; - /// Return the integer part of a number. + /// Returns the integer part of a number. fn trunc(self) -> Self; - /// Return the fractional part of a number. + /// Returns the fractional part of a number. fn fract(self) -> Self; /// Computes the absolute value of `self`. Returns `Float::nan()` if the @@ -2615,21 +2615,21 @@ pub trait Float /// error. This produces a more accurate result with better performance than /// a separate multiplication operation followed by an add. fn mul_add(self, a: Self, b: Self) -> Self; - /// Take the reciprocal (inverse) of a number, `1/x`. + /// Takes the reciprocal (inverse) of a number, `1/x`. fn recip(self) -> Self; - /// Raise a number to an integer power. + /// Raises a number to an integer power. /// /// Using this function is generally faster than using `powf` fn powi(self, n: i32) -> Self; - /// Raise a number to a floating point power. + /// Raises a number to a floating point power. fn powf(self, n: Self) -> Self; - /// Take the square root of a number. + /// Takes the square root of a number. /// /// Returns NaN if `self` is a negative number. fn sqrt(self) -> Self; - /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. + /// Takes the reciprocal (inverse) square root of a number, `1/sqrt(x)`. fn rsqrt(self) -> Self; /// Returns `e^(self)`, (the exponential function). @@ -2645,9 +2645,9 @@ pub trait Float /// Returns the base 10 logarithm of the number. fn log10(self) -> Self; - /// Convert radians to degrees. + /// Converts radians to degrees. fn to_degrees(self) -> Self; - /// Convert degrees to radians. + /// Converts degrees to radians. fn to_radians(self) -> Self; } @@ -2682,7 +2682,7 @@ macro_rules! from_str_radix_float_impl { impl FromStr for $T { type Err = ParseFloatError; - /// Convert a string in base 10 to a float. + /// Converts a string in base 10 to a float. /// Accepts an optional decimal exponent. /// /// This function accepts strings such as @@ -2719,7 +2719,7 @@ macro_rules! from_str_radix_float_impl { impl FromStrRadix for $T { type Err = ParseFloatError; - /// Convert a string in a given base to a float. + /// Converts a string in a given base to a float. /// /// Due to possible conflicts, this function does **not** accept /// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor** |
