BigInt
andBigUint
now implementProduct
andSum
for iterators of any item that we canMul
andAdd
, respectively. For example, a factorial can now be simply:let f: BigUint = (1u32..1000).product();
BigInt
now supports two's-complement logic operations, namelyBitAnd
,BitOr
,BitXor
, andNot
. These act conceptually as if each number had an infinite prefix of0
or1
bits for positive or negative.BigInt
now supports assignment operators likeAddAssign
.BigInt
andBigUint
now support conversions withi128
andu128
, if sufficient compiler support is detected.BigInt
andBigUint
now implement rand'sSampleUniform
trait, and a customRandomBits
distribution samples by bit size.- The release also includes other miscellaneous improvements to performance.
num-bigint
now requires rustc 1.15 or greater.- The crate now has a
std
feature, and won't build without it. This is in preparation for someday supporting#![no_std]
withalloc
. - The
serde
dependency has been updated to 1.0, still disabled by default. Therustc-serialize
crate is no longer supported bynum-bigint
. - The
rand
dependency has been updated to 0.5, now disabled by default. This requires rustc 1.22 or greater forrand
's own requirement. Shr for BigInt
now rounds down rather than toward zero, matching the behavior of the primitive integers for negative values.ParseBigIntError
is now an opaque type.- The
big_digit
module is no longer public, nor are theBigDigit
andDoubleBigDigit
types andZERO_BIG_DIGIT
constant that were re-exported in the crate root. Public APIs which deal in digits, likeBigUint::from_slice
, will now always be base-u32
.
Contributors: @clarcharr, @cuviper, @dodomorandi, @tiehuis, @tspiteri
- Division with single-digit divisors is now much faster.
- The README now compares
ramp
,rug
,rust-gmp
, andapint
.
Contributors: @cuviper, @Robbepop
- The new
BigInt::modpow
performs signed modular exponentiation, using the existingBigUint::modpow
and rounding negatives similar tomod_floor
.
Contributors: @cuviper
- num-bigint now has its own source repository at rust-num/num-bigint.
lcm
now avoids creating a large intermediate product.gcd
now uses Stein's algorithm with faster shifts instead of division.rand
support is now extended to 0.4 (while still allowing 0.3).
Contributors: @cuviper, @Emerentius, @ignatenkobrain, @mhogrefe
No prior release notes were kept. Thanks all the same to the many contributors that have made this crate what it is!