Commit Graph

60 Commits

Author SHA1 Message Date
Josh Stone 043a5b2918 pow: avoid unnecessary overflows
The code was performing an extra squaring of the base, which might
trigger an arithmetic overflow that doesn't matter to the result.  Now
this squaring is only attempted when enough exp remains to need it.

A new doctest tries pow(6u8, 3), where an extra square would exceed 256.
2015-03-07 14:12:50 -08:00
Alex Crichton 817dec99aa Remove usage of deprecated apis 2015-03-04 09:45:19 -08:00
Steve Jahns fb6b4ae9df Rust nightly needs explicit cast from u32 to usize 2015-03-04 09:43:44 -07:00
Austin Bonander f260a7f565 Upgrade to latest Rust 2015-02-20 10:37:11 -08:00
Huon Wilson 6adaa4de8f Merge #61. 2015-02-19 12:46:57 +11:00
Huon Wilson 2a3f2f060d Fix test. 2015-02-19 12:46:43 +11:00
Sam Payson 609c2e6ef0 Minor changes to silence warnings. 2015-02-18 16:41:28 -08:00
Sam Payson 6a0c32782e Change `radix` to u32, to build with new rustc. 2015-02-18 16:29:46 -08:00
Alex Crichton e2f0b0d327 Update to rust master 2015-02-05 08:20:16 -08:00
Alex Crichton 0811c72bac Bump to 0.1.12 2015-02-03 12:37:01 -08:00
Matt Brubeck e68ea18edc Silence unstable feature warnings 2015-02-03 12:32:28 -08:00
Matt Brubeck 42edb63090 Update FromStr and FromStrRadix to return Result
Fixes build errors with Rust 1.0.0-nightly.
2015-02-03 12:31:10 -08:00
Matt Brubeck b324415930 Change Show to Debug
Fixes deprecation warning
2015-02-03 11:05:55 -08:00
Gulshan Singh 7ba31bc3a7 Implemented from_bytes and to_bytes 2015-02-01 20:17:34 -05:00
Alex Crichton c05cd530db Bump to 0.1.10 2015-01-23 08:54:55 -08:00
Gulshan Singh f1bfd76bbb Fixed some typos and added some examples 2015-01-20 19:25:02 -05:00
Renato Zannon 791264ddfc Rename BigDigit module to big_digit
Without this rename, the library fails to compile on Rust master, since rust-lang/rust#21269 has landed.
2015-01-20 17:17:43 -02:00
Alex Crichton 45f5cc39bd s/bigusize/biguint/ 2015-01-09 13:54:32 -08:00
Huon Wilson 139cf8cf66 Bump to 0.1.7. 2015-01-09 22:36:03 +11:00
Alex Crichton bfa91ee92a Bump to 0.1.6 2015-01-07 12:09:44 -08:00
gifnksm 8219095e39 update to rust mater 2015-01-05 01:59:44 +09:00
Alex Crichton ce93a10ed0 Finish update and bump version number 2015-01-03 13:52:06 -08:00
Sven Nilsen ae3bb3619c Upgrade to latest Rust
A `_0` test fails, but don’t know why
2015-01-03 19:30:05 +01:00
Alex Crichton c11ff27994 Update to rust master 2015-01-01 09:07:52 -08:00
Alex Crichton 5d4b921537 Fix build warnings 2014-12-23 09:51:08 -08:00
Zbigniew Siciarz a006968185 Fix Ordering import 2014-12-23 17:12:57 +01:00
Zbigniew Siciarz 22c50901ff Convert Result to Option in parse_bytes.
`str::from_utf8` changed its return type to `Result`, but
`num::FromStrRadix::from_str_radix` still returns an `Option`. In this case
discarding the `Err` variant with `ok()` seems fine to me.
2014-12-23 17:09:22 +01:00
gifnksm 9316be3bc1 update to latest rustc 2014-12-21 19:41:03 +09:00
Chase McCarthy a7e9e79049 Add semicolons to macro lines 2014-12-18 21:01:24 -05:00
gifnksm a325a566c6 update to latest rustc
Now, arithmetic binary operator traits take operands by value,
but non-copyable types such as `BigUint` should not always moved out when
applying operators.

This commit implements these operators not only for bare structs also
these references.
By-value implementations are forwarded to by-reference implementations
for now. In the future, by-value implementations may be replaced with
more efficient implementations (for example, the implementation that
reuses moved buffers.)
2014-12-16 23:44:16 +09:00
gifnksm 1533fe2017 fix deperecation warning 2014-12-09 23:48:37 +09:00
gifnksm d89fbbf044 Add `deriving(Copy)` for `Copy`able structs/enums/ 2014-12-09 23:46:39 +09:00
Alex Crichton 01cc022174 Merge pull request #36 from steveklabnik/license
remove license attribute
2014-12-07 20:48:25 -05:00
Steve Klabnik 253f0bd3f3 don't allow deprecated items.
We don't actually use any.
2014-12-07 13:22:01 -05:00
Steve Klabnik ecc2e5fab7 remove license attribute 2014-12-07 13:20:39 -05:00
gifnksm b20dda2307 Update to iter stabilization.
`AdditiveIterator::sum` and `MultiplicativeIterator::product` now take bare self.
2014-11-27 23:06:06 +09:00
Alex Crichton 39acd8f2fb Update tests to rust master 2014-11-20 12:21:06 -08:00
gifnksm 233c02030d Fix for namespaced enums. 2014-11-18 21:09:53 +09:00
gifnksm 29011d14d9 std::from_str::FromStr -> std::str::FromStr 2014-11-17 22:38:12 +09:00
gifnksm 3568298a22 Add `iter` modules for generic number iteration.
The codes are imported from the standard library.
2014-11-16 19:37:53 +09:00
gifnksm 2155e7d2ee Add numeric functions and `traits` module that provide numeric traits for generic
mathematcs.

Import numeric traits and functions that were removed from the standard library.
This also implements `AdditiveIterator` and `MultiplicativeIterator` for
`BigUint` and `BigInt`.

closes #28
2014-11-16 19:37:49 +09:00
gifnksm 7a7c5fb2ad Implements `Encodable` and `Decodable`
Fixes #27
2014-11-13 20:54:42 +09:00
Alex Crichton da2fcbaa0c Merge pull request #25 from jbcrail/fix-overflow-literal
Fix overflowing literal in LCM test.
2014-11-07 23:31:17 -06:00
Joseph Crail fc984d4432 Fix overflowing literal in LCM test. 2014-11-07 21:24:49 -05:00
Joseph Crail e09b009edb Remove unused imports. 2014-11-07 21:21:23 -05:00
Joseph Crail 40873fb0c6 Fix two non uppercase globals. 2014-11-06 22:47:10 -05:00
gifnksm 272d6edb79 Update to latest rustc 2014-11-06 22:09:03 +09:00
gifnksm d3fd33a878 Fix lint name warning 2014-11-05 07:32:00 +09:00
gifnksm 163646cd63 Use sliciing_syntax 2014-11-05 07:32:00 +09:00
gifnksm 436f954627 bigint: Refactor the `parse_bytes` and `from_str_radix`.
This follows the changes of "Separate string->integer implementation in strconv" (rust-lang/rust@138b76b).
This allows `parse_bytes` to be removed without breaking `libnum` code.
2014-11-05 07:31:53 +09:00