diff options
Diffstat (limited to 'src/libnum/rational.rs')
| -rw-r--r-- | src/libnum/rational.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index ba0a571268f..71a23a23a26 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -34,7 +34,7 @@ pub type Rational64 = Ratio<i64>; /// Alias for arbitrary precision rationals. pub type BigRational = Ratio<BigInt>; -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Ratio<T> { /// Create a ratio representing the integer `t`. #[inline] @@ -192,14 +192,14 @@ macro_rules! cmp_impl { } }; } -cmp_impl!(impl Eq, eq, ne) -cmp_impl!(impl Ord, lt, gt, le, ge) +cmp_impl!(impl PartialEq, eq, ne) +cmp_impl!(impl PartialOrd, lt, gt, le, ge) cmp_impl!(impl TotalEq, ) cmp_impl!(impl TotalOrd, cmp -> cmp::Ordering) /* Arithmetic */ // a/b * c/d = (a*c)/(b*d) -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Mul<Ratio<T>,Ratio<T>> for Ratio<T> { #[inline] fn mul(&self, rhs: &Ratio<T>) -> Ratio<T> { @@ -208,7 +208,7 @@ impl<T: Clone + Integer + Ord> } // (a/b) / (c/d) = (a*d)/(b*c) -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Div<Ratio<T>,Ratio<T>> for Ratio<T> { #[inline] fn div(&self, rhs: &Ratio<T>) -> Ratio<T> { @@ -219,7 +219,7 @@ impl<T: Clone + Integer + Ord> // Abstracts the a/b `op` c/d = (a*d `op` b*d) / (b*d) pattern macro_rules! arith_impl { (impl $imp:ident, $method:ident) => { - impl<T: Clone + Integer + Ord> + impl<T: Clone + Integer + PartialOrd> $imp<Ratio<T>,Ratio<T>> for Ratio<T> { #[inline] fn $method(&self, rhs: &Ratio<T>) -> Ratio<T> { @@ -239,7 +239,7 @@ arith_impl!(impl Sub, sub) // a/b % c/d = (a*d % b*c)/(b*d) arith_impl!(impl Rem, rem) -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Neg<Ratio<T>> for Ratio<T> { #[inline] fn neg(&self) -> Ratio<T> { @@ -248,7 +248,7 @@ impl<T: Clone + Integer + Ord> } /* Constants */ -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Zero for Ratio<T> { #[inline] fn zero() -> Ratio<T> { @@ -261,7 +261,7 @@ impl<T: Clone + Integer + Ord> } } -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> One for Ratio<T> { #[inline] fn one() -> Ratio<T> { @@ -269,7 +269,7 @@ impl<T: Clone + Integer + Ord> } } -impl<T: Clone + Integer + Ord> +impl<T: Clone + Integer + PartialOrd> Num for Ratio<T> {} /* String conversions */ @@ -288,7 +288,7 @@ impl<T: ToStrRadix> ToStrRadix for Ratio<T> { } } -impl<T: FromStr + Clone + Integer + Ord> +impl<T: FromStr + Clone + Integer + PartialOrd> FromStr for Ratio<T> { /// Parses `numer/denom`. fn from_str(s: &str) -> Option<Ratio<T>> { @@ -305,7 +305,7 @@ impl<T: FromStr + Clone + Integer + Ord> }) } } -impl<T: FromStrRadix + Clone + Integer + Ord> +impl<T: FromStrRadix + Clone + Integer + PartialOrd> FromStrRadix for Ratio<T> { /// Parses `numer/denom` where the numbers are in base `radix`. fn from_str_radix(s: &str, radix: uint) -> Option<Ratio<T>> { |
