Commit Graph

30 Commits

Author SHA1 Message Date
Josh Stone 1b895a8632 Get the default hasher indirectly
`DefaultHasher` wasn't stable until 1.13, at which point all the other
hashers were deprecated, so it's not easy for us to name a hasher type
to use for testing.  However, `RandomState` has been stable since 1.7,
and it implements `BuildHasher` that has a `Hasher` associated type.
2017-05-06 22:23:31 -07:00
Patrick Jackson 71a15212a1 Replace deprecated SipHasher. 2017-04-28 18:48:50 -07:00
Josh Stone d23e3f32b8 num-bigint-0.1.37 2017-03-08 11:14:32 -08:00
Josh Stone 0b6cae0dc7 bigint: Create the parsing error better for nested `+`
If a `+` is encountered in the middle of parsing a BigUint, this should
generate an `ParseIntError::InvalidDigit`.  Since we can't create that
directly, we get it by trying to parse a `u64` from this point, but of
course `+` is a perfectly valid prefix to a `u64`.

Now we include the previous character in the string passed to `u64`, so
it has proper parsing context to understand what's in error.

Fixes #268.
2017-03-06 13:23:40 -08:00
Josh Stone 4b8c71fbec bigint: Cleanup unused imports 2017-03-06 13:20:30 -08:00
Josh Stone 1a66ee9e80 Add licenses to subcrates 2017-02-26 13:39:23 -08:00
bluss ff2a350e98 Use the integer32 playground 2016-11-02 19:51:10 +01:00
bluss e4a6956e5a Add doc(html_root_url) and other doc attrs to each crate
Also update to use https instead of http. This avois mixed content
degradation on docs.rs.

The doc root URLs are correct as they are, the URL does not include the
crate name itself.
2016-11-01 02:14:23 +01:00
Aleksey Kladov ec6ce78458 Minor, style and comment typo 2016-10-05 18:47:30 +03:00
Josh Stone c8ed8ff87b num, bigint, complex, rational, traits: 0.1.35 2016-08-18 08:28:34 -07:00
Richard Janis Goldschmidt a4ccb797cf Allow serde version in [0.7,0.9) 2016-08-17 12:20:08 +02:00
Josh Stone 5c3d759d6c bigint: inline bits() methods 2016-08-10 22:23:28 -07:00
Kent Overstreet 279522316c bigint: Break out into multiple files 2016-07-18 15:56:03 -08:00
Kent Overstreet 8e0baecf5c Drop some dependencies on BigDigit's size
Before:
test divide_0          ... bench:       1,011 ns/iter (+/- 184)
test divide_1          ... bench:      18,535 ns/iter (+/- 770)
test divide_2          ... bench:     990,467 ns/iter (+/- 91,980)
test fac_to_string     ... bench:       1,275 ns/iter (+/- 60)
test factorial_100     ... bench:       6,453 ns/iter (+/- 101)
test fib_100           ... bench:       1,142 ns/iter (+/- 99)
test fib_1000          ... bench:      18,713 ns/iter (+/- 2,172)
test fib_10000         ... bench:   1,197,965 ns/iter (+/- 21,178)
test fib_to_string     ... bench:         225 ns/iter (+/- 13)
test from_str_radix_02 ... bench:       3,460 ns/iter (+/- 626)
test from_str_radix_08 ... bench:       1,324 ns/iter (+/- 24)
test from_str_radix_10 ... bench:       1,488 ns/iter (+/- 19)
test from_str_radix_16 ... bench:         969 ns/iter (+/- 22)
test from_str_radix_36 ... bench:       1,135 ns/iter (+/- 23)
test hash              ... bench:     102,126 ns/iter (+/- 1,016)
test multiply_0        ... bench:         353 ns/iter (+/- 74)
test multiply_1        ... bench:      31,006 ns/iter (+/- 679)
test multiply_2        ... bench:   3,438,143 ns/iter (+/- 47,640)
test pow_bench         ... bench:   7,457,045 ns/iter (+/- 96,175)
test shl               ... bench:       5,627 ns/iter (+/- 121)
test shr               ... bench:       5,054 ns/iter (+/- 112)
test to_str_radix_02   ... bench:       2,774 ns/iter (+/- 88)
test to_str_radix_08   ... bench:         980 ns/iter (+/- 425)
test to_str_radix_10   ... bench:       3,029 ns/iter (+/- 115)
test to_str_radix_16   ... bench:         788 ns/iter (+/- 14)
test to_str_radix_36   ... bench:       8,285 ns/iter (+/- 175)

After:
test divide_0          ... bench:         925 ns/iter (+/- 30)
test divide_1          ... bench:      17,660 ns/iter (+/- 379)
test divide_2          ... bench:     972,427 ns/iter (+/- 7,560)
test fac_to_string     ... bench:       1,260 ns/iter (+/- 36)
test factorial_100     ... bench:       7,077 ns/iter (+/- 204)
test fib_100           ... bench:       1,124 ns/iter (+/- 32)
test fib_1000          ... bench:      18,475 ns/iter (+/- 166)
test fib_10000         ... bench:   1,192,748 ns/iter (+/- 27,128)
test fib_to_string     ... bench:         228 ns/iter (+/- 10)
test from_str_radix_02 ... bench:       3,379 ns/iter (+/- 74)
test from_str_radix_08 ... bench:       1,355 ns/iter (+/- 24)
test from_str_radix_10 ... bench:       1,470 ns/iter (+/- 20)
test from_str_radix_16 ... bench:         958 ns/iter (+/- 239)
test from_str_radix_36 ... bench:       1,137 ns/iter (+/- 19)
test hash              ... bench:     102,730 ns/iter (+/- 39,897)
test multiply_0        ... bench:         351 ns/iter (+/- 15)
test multiply_1        ... bench:      31,139 ns/iter (+/- 1,053)
test multiply_2        ... bench:   3,464,509 ns/iter (+/- 124,235)
test pow_bench         ... bench:   7,448,428 ns/iter (+/- 326,903)
test shl               ... bench:       5,784 ns/iter (+/- 190)
test shr               ... bench:       4,820 ns/iter (+/- 63)
test to_str_radix_02   ... bench:       2,757 ns/iter (+/- 33)
test to_str_radix_08   ... bench:         989 ns/iter (+/- 67)
test to_str_radix_10   ... bench:       3,045 ns/iter (+/- 70)
test to_str_radix_16   ... bench:         787 ns/iter (+/- 24)
test to_str_radix_36   ... bench:       8,257 ns/iter (+/- 117)/
2016-07-14 21:56:16 -08:00
Josh Stone 9924163086 bigint: bump to 0.1.33 2016-07-12 01:10:37 -07:00
Josh Stone 8f5a27284c Remove an unused ToBigUint import 2016-07-12 00:40:10 -07:00
Josh Stone 388a3132b8 bigint: allow `Sub` to work in-place on the RHS
A new Fibonacci benchmark demonstrates the improvement by using both
addition and subtraction in each iteration of the loop, like #200.

Before:

    test fib2_100          ... bench:       4,558 ns/iter (+/- 3,357)
    test fib2_1000         ... bench:      62,575 ns/iter (+/- 5,200)
    test fib2_10000        ... bench:   2,898,425 ns/iter (+/- 207,973)

After:

    test fib2_100          ... bench:       1,973 ns/iter (+/- 102)
    test fib2_1000         ... bench:      41,203 ns/iter (+/- 947)
    test fib2_10000        ... bench:   2,544,272 ns/iter (+/- 45,183)
2016-07-08 17:34:12 -07:00
Josh Stone 609629d34d bigint: simplify the add2/sub2 loops
This splits the main arithmetic loops from the final carry/borrow
propagation, and also normalizes the slice lengths before iteration.
This lets the optimizer generate better code for these functions.
2016-06-29 18:19:47 -07:00
Kent Overstreet 1e65e9dc51 bigint: Fix calculation of size for multiply temporaries
When x.len() and y.len() are both equal and odd, we have x1.len() + y1.len() + 1
(the required size to multiply x1 and y1) > y.len() + 1

This fixes #187
2016-04-20 15:48:02 -08:00
Josh Stone 0b79edc108 bigint: add path-dependency versions 2016-04-14 00:26:54 -07:00
Josh Stone 2e8ce33d84 Bump all num crates to 0.1.32 2016-04-14 00:17:42 -07:00
Łukasz Jan Niemier 58b5fe5883 Serializers dependencies 2016-04-11 20:43:07 +02:00
Łukasz Jan Niemier e59ead7b3a Add Serde crate to `num_bigint` 2016-04-11 12:32:10 +02:00
Łukasz Jan Niemier 3d11940538 Better descriptions for subcrates 2016-04-10 10:31:22 +02:00
Josh Stone 03884fdbcc bigint: reapply #176 2016-03-25 17:50:51 -07:00
Josh Stone aebbc4fd37 bigint: fix and un-ignore the first doctest 2016-03-25 17:50:51 -07:00
Josh Stone 21a328ad6d bigint, rational: use std::hash only for testing 2016-03-25 17:50:51 -07:00
Łukasz Jan Niemier 7c0ab30bdc Fix subpackages metadata 2016-03-11 10:22:26 +01:00
Łukasz Jan Niemier 54685c46a1 Extract rational 2016-03-11 01:06:37 +01:00
Łukasz Jan Niemier 2176b7048c Extract bigint 2016-03-11 01:06:05 +01:00