diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-24 22:45:57 +1000 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-25 08:20:00 +1000 |
| commit | 024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd (patch) | |
| tree | 7ba0a339d6bf55e5191e94c697823895279b967f /src/libcore/num | |
| parent | d4868ee74085c2dc2943ef9407ced2d06e43abf6 (diff) | |
| download | rust-024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd.tar.gz rust-024bf2ec72bdc2428d5c58a59bfed7da1bbc4efd.zip | |
Rename Natural to Integer
'Natural' normally means 'positive integer' in mathematics. It is therefore strange to implement it on signed integer types. 'Integer' is probably a better choice.
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/int-template.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/num.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/uint-template.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index cb29b9e4486..e322e5edeb9 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -279,7 +279,7 @@ impl Signed for T { fn is_negative(&self) -> bool { *self < 0 } } -impl Natural for T { +impl Integer for T { /** * Floored integer division * diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs index 8304179c346..1c3c699603b 100644 --- a/src/libcore/num/num.rs +++ b/src/libcore/num/num.rs @@ -61,7 +61,7 @@ pub fn abs<T:Ord + Zero + Neg<T>>(v: T) -> T { if v < Zero::zero() { v.neg() } else { v } } -pub trait Natural: Num +pub trait Integer: Num + Ord + Quot<Self,Self> + Rem<Self,Self> { diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index 2ee64d4e4ea..69483f33e52 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -176,7 +176,7 @@ impl Neg<T> for T { impl Unsigned for T {} -impl Natural for T { +impl Integer for T { /// Unsigned integer division. Returns the same result as `quot` (`/`). #[inline(always)] fn div(&self, other: T) -> T { *self / other } |
