Contributors: @cuviper, @HactarCE
Contributors: @cuviper, @tspiteri
BigUint::to_u32_digits
method returns the number as a little-endian vector of base-232 digits. The same method on BigInt
also returns the sign.BigUint::modpow
now applies a modulus even for exponent 1, which also affects BigInt::modpow
.BigInt::modpow
now returns the correct sign for negative bases with even exponents.Contributors: @alex-ozdemir, @cuviper, @dingelish, @Speedy37, @youknowone
Pow
is now implemented for BigUint
exponents.quickcheck
feature enables implementations of Arbitrary
.Contributors: @cuviper, @lcnr, @maxbla, @mikelodder7, @mikong, @TheLetterTheta, @tspiteri, @XAMPPRocky, @youknowone
Roots
implementations now use better initial guesses.to_signed_bytes_*
for some positive numbers, where the most-significant byte is 0x80
and the rest are 0
.Contributors: @cuviper, @leodasvacas
RandBigInt
now uses Rng::fill_bytes
to improve performance, instead of repeated gen::<u32>
calls. The also affects the implementations of the other rand
traits. This may potentially change the values produced by some seeded RNGs on previous versions, but the values were tested to be stable with ChaChaRng
, IsaacRng
, and XorShiftRng
.BigInt
and BigUint
now implement num_integer::Roots
.BigInt
and BigUint
now implement num_traits::Pow
.BigInt
and BigUint
now implement operators with 128-bit integers.Contributors: @cuviper, @dignifiedquire, @mancabizjak, @Robbepop, @TheIronBorn, @thomwiggers
BigInt
and BigUint
now implement Product
and Sum
for iterators of any item that we can Mul
and Add
, respectively. For example, a factorial can now be simply: let f: BigUint = (1u32..1000).product();
BigInt
now supports two's-complement logic operations, namely BitAnd
, BitOr
, BitXor
, and Not
. These act conceptually as if each number had an infinite prefix of 0
or 1
bits for positive or negative.BigInt
now supports assignment operators like AddAssign
.BigInt
and BigUint
now support conversions with i128
and u128
, if sufficient compiler support is detected.BigInt
and BigUint
now implement rand's SampleUniform
trait, and a custom RandomBits
distribution samples by bit size.num-bigint
now requires rustc 1.15 or greater.std
feature, and won't build without it. This is in preparation for someday supporting #![no_std]
with alloc
.serde
dependency has been updated to 1.0, still disabled by default. The rustc-serialize
crate is no longer supported by num-bigint
.rand
dependency has been updated to 0.5, now disabled by default. This requires rustc 1.22 or greater for rand
'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.big_digit
module is no longer public, nor are the BigDigit
and DoubleBigDigit
types and ZERO_BIG_DIGIT
constant that were re-exported in the crate root. Public APIs which deal in digits, like BigUint::from_slice
, will now always be base-u32
.Contributors: @clarcharr, @cuviper, @dodomorandi, @tiehuis, @tspiteri
ramp
, rug
, rust-gmp
, and apint
.Contributors: @cuviper, @Robbepop
BigInt::modpow
performs signed modular exponentiation, using the existing BigUint::modpow
and rounding negatives similar to mod_floor
.Contributors: @cuviper
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!