about summary refs log tree commit diff
path: root/src/libstd/num
AgeCommit message (Collapse)AuthorLines
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-11auto merge of #6429 : gifnksm/rust/bigint-is_even, r=catamorphismbors-1/+12
`BigUint::is_even()` didn't return correct value.
2013-05-11Warning policeTim Chevalier-2/+0
2013-05-12libstd: Fix BigUint::is_evengifnksm-1/+12
2013-05-10renamed vec::from_slice to vec::to_ownedYoungsoo Son-1/+1
2013-05-09remove vecs_implicitly_copyable from libstd/libcoreDaniel Micay-1/+0
2013-05-07Add abs_sub method to Signed traitBrendan Zabarauskas-0/+14
2013-05-03add gitattributes and fix whitespace issuesDaniel Micay-1/+0
2013-05-02libcore: Export core::from_str::FromStr from core::preludegifnksm-3/+2
2013-05-02libstd: impl Clone for BigUint/BigInt and replace `copy` with `.clone()`gifnksm-11/+13
2013-05-01Revert rename of Div to QuotBrendan Zabarauskas-70/+67
2013-04-29auto merge of #6108 : gifnksm/rust/bigint-shift-bug, r=brsonbors-21/+39
`std::bigint` contains the following code. ```rust borrow = *elem << (uint::bits - n_bits); ``` The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand, because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture. If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`, but if --opt-level is given, `borrow` is always zero. I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug, but the unittest passes normally.) This pull request also removes the implicit vector copies in `bigint.rs`.
2013-04-29Rename 'divisible_by' method to 'is_multiple_of', add tests for 'is_odd' and ↵Brendan Zabarauskas-2/+2
'is_even'
2013-04-29Implement Fractional for RatioBrendan Zabarauskas-0/+18
2013-04-29libstd: modify wrong shift width.gifnksm-1/+2
borrow = *elem << (uint::bits - n_bits); The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand, because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture. If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`, but if --opt-level is given, `borrow` is always zero. I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug, but the unittest passes normally.)
2013-04-29libstd: remove implicit copying of BigInt/BigUintgifnksm-20/+37
2013-04-28auto merge of #6092 : gifnksm/rust/impl-integer-bigint, r=graydonbors-144/+383
This is a follow-up commit for #6041 (and depending on #6048). Also adding `#[inline(always)]` for almost every methods in `std::bigint`.
2013-04-28libstd: inlining almost every methods in bigint module.gifnksm-1/+86
2013-04-28libstd: impl Integer for BigUint/BigInt.gifnksm-143/+297
Also remove abs() method from the non-trait impl for BigInt/BigUint. That method is provided in the Signed trait.
2013-04-27only use #[no_core] in libcoreDaniel Micay-6/+0
2013-04-26Add is_zero method to ZeroBrendan Zabarauskas-19/+27
2013-04-25Update impl of Round for RatioBrendan Zabarauskas-20/+22
2013-04-24Implement Signed and Unsigned traits and remove related predicate functionsBrendan Zabarauskas-8/+25
2013-04-22auto merge of #6013 : gifnksm/rust/bigint-quot-rem, r=graydonbors-56/+57
BigInt had been supported quot/rem and div/mod correctly, but after merging #5990 they have been broken. This commit fixes it.
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-23libstd: correct bigint's quot/rem, div/modulogifnksm-56/+57
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-74/+63
2013-04-20std: remove unused 'mut' variablesAlex Crichton-2/+2
2013-04-08Removing no longer needed unsafe blocksAlex Crichton-1/+1
2013-04-08Removing some mutable fields in libstdAlex Crichton-1/+0
2013-04-07Impl cmp/num traits for BigUint, BigIntgifnksm-145/+187
TotalEq, TotalOrd, FromStrRadix, ToStrRadix.
2013-04-05libstd: make complex.rs XXX's into issues and FIXME'sHuon Wilson-4/+3
2013-04-05libstd: add basic complex numbersHuon Wilson-0/+316
2013-04-05libstd: add basic rational numbersHuon Wilson-0/+511
2013-04-05libstd: move bigint to dedicated num directoryHuon Wilson-0/+1647