diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-08-30 23:45:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-08-30 23:45:52 -0700 |
| commit | 6b3aa5832f073914700044770944dbad0ecda30d (patch) | |
| tree | f027c093a7970757508fd707a7f3d901c54741e4 /src | |
| parent | e442406dd7fd4c8e2d3f4ad6c7468aadd632d6b6 (diff) | |
| parent | c09c038e11d8ed84a965179903891628dd72573f (diff) | |
| download | rust-6b3aa5832f073914700044770944dbad0ecda30d.tar.gz rust-6b3aa5832f073914700044770944dbad0ecda30d.zip | |
rollup merge of #16769 : rgawdzik/abs_doc_addition
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/num/mod.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 42f74ab429a..6d6ca59ce01 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -160,6 +160,8 @@ pub trait Signed: Num + Neg<Self> { /// 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`. fn abs(&self) -> Self; /// The positive difference of two numbers. @@ -176,7 +178,7 @@ pub trait Signed: Num + Neg<Self> { /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// * `NaN` if the number is `NaN` /// - /// For `int`: + /// For signed integers: /// /// * `0` if the number is zero /// * `1` if the number is positive @@ -272,6 +274,8 @@ signed_float_impl!(f64, f64::NAN, f64::INFINITY, f64::NEG_INFINITY, /// 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() @@ -294,7 +298,7 @@ pub fn abs_sub<T: Signed>(x: T, y: T) -> T { /// * `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// * `NaN` if the number is `NaN` /// -/// For int: +/// For signed integers: /// /// * `0` if the number is zero /// * `1` if the number is positive |
