]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #6471 : gifnksm/rust/reform-rational, r=brson
authorbors <bors@rust-lang.org>
Tue, 14 May 2013 22:28:59 +0000 (15:28 -0700)
committerbors <bors@rust-lang.org>
Tue, 14 May 2013 22:28:59 +0000 (15:28 -0700)
`std::ratio` module contains `BigRational` type, but the type is not usable by following reasons.
* `Ratio::new` requires `T: Copy + Num + Ord`, but `BigInt` is not implicitly copyable, because it contains unique vector.
* `BigInt` is not implements `Num`

So, I rewrite `Ratio` as follows.
* `Ratio` requires `T: Clone + Integer + Ord`.
  * `Copy` -> `Clone`: to be able to use `BigRational`
  * `Num` -> `Integer`: It is incorrect that a rational number constructed by two non-integer numbers.
* `BigInt` implements `Num` and `Orderable` which are required by `Integer` bound

1  2 
src/libstd/num/rational.rs

Simple merge