diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-09 16:59:28 +1100 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2014-11-13 02:02:43 +1100 |
| commit | e6db701d5b09c169297aaaf2d5d53f64bcb4676e (patch) | |
| tree | 2e43cc404663158bd2e4fef75e0c53c1183776ff /src/libcore/num | |
| parent | 8666812dce7e219501642d4aabfd89e6b986834f (diff) | |
| download | rust-e6db701d5b09c169297aaaf2d5d53f64bcb4676e.tar.gz rust-e6db701d5b09c169297aaaf2d5d53f64bcb4676e.zip | |
Deprecate Signed method wrappers
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/mod.rs | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 86ac4ea79ce..61fabae4b8b 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -271,25 +271,6 @@ signed_float_impl!(f32, f32::NAN, f32::INFINITY, f32::NEG_INFINITY, signed_float_impl!(f64, f64::NAN, f64::INFINITY, f64::NEG_INFINITY, intrinsics::fabsf64, intrinsics::copysignf64, fdim) -/// Computes the absolute value. -/// -/// For `f32` and `f64`, `NaN` will be returned if the number is `NaN` -/// -/// For signed integers, `::MIN` will be returned if the number is `::MIN`. -#[inline(always)] -pub fn abs<T: Signed>(value: T) -> T { - value.abs() -} - -/// The positive difference of two numbers. -/// -/// Returns zero if `x` is less than or equal to `y`, otherwise the difference -/// between `x` and `y` is returned. -#[inline(always)] -pub fn abs_sub<T: Signed>(x: T, y: T) -> T { - x.abs_sub(y) -} - /// Returns the sign of the number. /// /// For `f32` and `f64`: @@ -1560,3 +1541,10 @@ pub trait Float: Signed + Primitive { /// Convert degrees to radians. fn to_radians(self) -> Self; } + +// DEPRECATED + +#[deprecated = "Use `Signed::abs`"] +pub fn abs<T: Signed>(value: T) -> T { value.abs() } +#[deprecated = "Use `Signed::abs_sub`"] +pub fn abs_sub<T: Signed>(x: T, y: T) -> T { x.abs_sub(y) } |
