about summary refs log tree commit diff
path: root/src/libstd/num/rational.rs
AgeCommit message (Collapse)AuthorLines
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-531/+0
This only changes the directory names; it does not change the "real" metadata names.
2013-05-14auto merge of #6471 : gifnksm/rust/reform-rational, r=brsonbors-83/+85
`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
2013-05-14Use static string with fail!() and remove fail!(fmt!())Björn Steinbrink-1/+1
fail!() used to require owned strings but can handle static strings now. Also, it can pass its arguments to fmt!() on its own, no need for the caller to call fmt!() itself.
2013-05-14libstd: Add tests for BigRationalgifnksm-20/+56
2013-05-14libstd: `Ratio` requires `Clone` instead of `Copy`gifnksm-23/+28
This allows creating `Ratio<T>` which `T` is non-implicitly copyable types such as `BigInt`.
2013-05-14libstd: `Rational` requires `Integer` as type bounds instead of `Num`gifnksm-53/+14
2013-05-01Revert rename of Div to QuotBrendan Zabarauskas-4/+4
2013-04-29Implement Fractional for RatioBrendan Zabarauskas-0/+18
2013-04-27only use #[no_core] in libcoreDaniel Micay-4/+0
2013-04-26Add is_zero method to ZeroBrendan Zabarauskas-0/+5
2013-04-25Update impl of Round for RatioBrendan Zabarauskas-20/+22
2013-04-22auto merge of #5966 : alexcrichton/rust/issue-3083, r=graydonbors-2/+2
Closes #3083. This takes a similar approach to #5797 where a set is present on the `tcx` of used mutable definitions. Everything is by default warned about, and analyses must explicitly add mutable definitions to this set so they're not warned about. Most of this was pretty straightforward, although there was one caveat that I ran into when implementing it. Apparently when the old modes are used (or maybe `legacy_modes`, I'm not sure) some different code paths are taken to cause spurious warnings to be issued which shouldn't be issued. I'm not really sure how modes even worked, so I was having a lot of trouble tracking this down. I figured that because they're a legacy thing that I'd just de-mode the compiler so that the warnings wouldn't be a problem anymore (or at least for the compiler). Other than that, the entire compiler compiles without warnings of unused mutable variables. To prevent bad warnings, #5965 should be landed (which in turn is waiting on #5963) before landing this. I figured I'd stick it out for review anyway though.
2013-04-22libstd: denominator isn't quotientHuon Wilson-1/+1
2013-04-22Rename Div operator trait to Quot and Modulo operator trait to RemBrendan Zabarauskas-22/+19
2013-04-20std: remove unused 'mut' variablesAlex Crichton-2/+2
2013-04-05libstd: add basic rational numbersHuon Wilson-0/+511