1# Release 0.4.6 (2024-06-27) 2 3- [Fixed compilation on `x86_64-unknown-linux-gnux32`.][312] 4 5**Contributors**: @cuviper, @ralphtandetzky, @yhx-12243 6 7[312]: https://github.com/rust-num/num-bigint/pull/312 8 9# Release 0.4.5 (2024-05-06) 10 11- [Upgrade to 2021 edition, **MSRV 1.60**][292] 12- [Add `const ZERO` and implement `num_traits::ConstZero`][298] 13- [Add `modinv` methods for the modular inverse][288] 14- [Optimize multiplication with imbalanced operands][295] 15- [Optimize scalar division on x86 and x86-64][236] 16 17**Contributors**: @cuviper, @joelonsql, @waywardmonkeys 18 19[236]: https://github.com/rust-num/num-bigint/pull/236 20[288]: https://github.com/rust-num/num-bigint/pull/288 21[292]: https://github.com/rust-num/num-bigint/pull/292 22[295]: https://github.com/rust-num/num-bigint/pull/295 23[298]: https://github.com/rust-num/num-bigint/pull/298 24 25# Release 0.4.4 (2023-08-22) 26 27- [Implemented `From<bool>` for `BigInt` and `BigUint`.][239] 28- [Implemented `num_traits::Euclid` and `CheckedEuclid` for `BigInt` and `BigUint`.][245] 29- [Implemented ties-to-even for `BigInt` and `BigUint::to_f32` and `to_f64`.][271] 30- [Implemented `num_traits::FromBytes` and `ToBytes` for `BigInt` and `BigUint`.][276] 31- Limited pre-allocation from serde size hints against potential OOM. 32- Miscellaneous other code cleanups and maintenance tasks. 33 34**Contributors**: @AaronKutch, @archseer, @cuviper, @dramforever, @icecream17, 35@icedrocket, @janmarthedal, @jaybosamiya, @OliveIsAWord, @PatrickNorton, 36@smoelius, @waywardmonkeys 37 38[239]: https://github.com/rust-num/num-bigint/pull/239 39[245]: https://github.com/rust-num/num-bigint/pull/245 40[271]: https://github.com/rust-num/num-bigint/pull/271 41[276]: https://github.com/rust-num/num-bigint/pull/276 42 43# Release 0.4.3 (2021-11-02) 44 45- [GHSA-v935-pqmr-g8v9]: [Fix unexpected panics in multiplication.][228] 46 47**Contributors**: @arvidn, @cuviper, @guidovranken 48 49[228]: https://github.com/rust-num/num-bigint/pull/228 50[GHSA-v935-pqmr-g8v9]: https://github.com/rust-num/num-bigint/security/advisories/GHSA-v935-pqmr-g8v9 51 52# Release 0.4.2 (2021-09-03) 53 54- [Use explicit `Integer::div_ceil` to avoid the new unstable method.][219] 55 56**Contributors**: @catenacyber, @cuviper 57 58[219]: https://github.com/rust-num/num-bigint/pull/219 59 60# Release 0.4.1 (2021-08-27) 61 62- [Fixed scalar divide-by-zero panics.][200] 63- [Implemented `DoubleEndedIterator` for `U32Digits` and `U64Digits`.][208] 64- [Optimized multiplication to avoid unnecessary allocations.][199] 65- [Optimized string formatting for very large values.][216] 66 67**Contributors**: @cuviper, @PatrickNorton 68 69[199]: https://github.com/rust-num/num-bigint/pull/199 70[200]: https://github.com/rust-num/num-bigint/pull/200 71[208]: https://github.com/rust-num/num-bigint/pull/208 72[216]: https://github.com/rust-num/num-bigint/pull/216 73 74# Release 0.4.0 (2021-03-05) 75 76### Breaking Changes 77 78- Updated public dependences on [arbitrary, quickcheck][194], and [rand][185]: 79 - `arbitrary` support has been updated to 1.0, requiring Rust 1.40. 80 - `quickcheck` support has been updated to 1.0, requiring Rust 1.46. 81 - `rand` support has been updated to 0.8, requiring Rust 1.36. 82- [`Debug` now shows plain numeric values for `BigInt` and `BigUint`][195], 83 rather than the raw list of internal digits. 84 85**Contributors**: @cuviper, @Gelbpunkt 86 87[185]: https://github.com/rust-num/num-bigint/pull/185 88[194]: https://github.com/rust-num/num-bigint/pull/194 89[195]: https://github.com/rust-num/num-bigint/pull/195 90 91# Release 0.3.3 (2021-09-03) 92 93- [Use explicit `Integer::div_ceil` to avoid the new unstable method.][219] 94 95**Contributors**: @catenacyber, @cuviper 96 97# Release 0.3.2 (2021-03-04) 98 99- [The new `BigUint` methods `count_ones` and `trailing_ones`][175] return the 100 number of `1` bits in the entire value or just its least-significant tail, 101 respectively. 102- [The new `BigInt` and `BigUint` methods `bit` and `set_bit`][183] will read 103 and write individual bits of the value. For negative `BigInt`, bits are 104 determined as if they were in the two's complement representation. 105- [The `from_radix_le` and `from_radix_be` methods][187] now accept empty 106 buffers to represent zero. 107- [`BigInt` and `BigUint` can now iterate digits as `u32` or `u64`][192], 108 regardless of the actual internal digit size. 109 110**Contributors**: @BartMassey, @cuviper, @janmarthedal, @sebastianv89, @Speedy37 111 112[175]: https://github.com/rust-num/num-bigint/pull/175 113[183]: https://github.com/rust-num/num-bigint/pull/183 114[187]: https://github.com/rust-num/num-bigint/pull/187 115[192]: https://github.com/rust-num/num-bigint/pull/192 116 117# Release 0.3.1 (2020-11-03) 118 119- [Addition and subtraction now uses intrinsics][141] for performance on `x86` 120 and `x86_64` when built with Rust 1.33 or later. 121- [Conversions `to_f32` and `to_f64` now return infinity][163] for very large 122 numbers, rather than `None`. This does preserve the sign too, so a large 123 negative `BigInt` will convert to negative infinity. 124- [The optional `arbitrary` feature implements `arbitrary::Arbitrary`][166], 125 distinct from `quickcheck::Arbitrary`. 126- [The division algorithm has been optimized][170] to reduce the number of 127 temporary allocations and improve the internal guesses at each step. 128- [`BigInt` and `BigUint` will opportunistically shrink capacity][171] if the 129 internal vector is much larger than needed. 130 131**Contributors**: @cuviper, @e00E, @ejmahler, @notoria, @tczajka 132 133[141]: https://github.com/rust-num/num-bigint/pull/141 134[163]: https://github.com/rust-num/num-bigint/pull/163 135[166]: https://github.com/rust-num/num-bigint/pull/166 136[170]: https://github.com/rust-num/num-bigint/pull/170 137[171]: https://github.com/rust-num/num-bigint/pull/171 138 139# Release 0.3.0 (2020-06-12) 140 141### Enhancements 142 143- [The internal `BigDigit` may now be either `u32` or `u64`][62], although that 144 implementation detail is not exposed in the API. For now, this is chosen to 145 match the target pointer size, but may change in the future. 146- [No-`std` is now supported with the `alloc` crate on Rust 1.36][101]. 147- [`Pow` is now implemented for bigint values][137], not just references. 148- [`TryFrom` is now implemented on Rust 1.34 and later][123], converting signed 149 integers to unsigned, and narrowing big integers to primitives. 150- [`Shl` and `Shr` are now implemented for a variety of shift types][142]. 151- A new `trailing_zeros()` returns the number of consecutive zeros from the 152 least significant bit. 153- The new `BigInt::magnitude` and `into_parts` methods give access to its 154 `BigUint` part as the magnitude. 155 156### Breaking Changes 157 158- `num-bigint` now requires Rust 1.31 or greater. 159 - The "i128" opt-in feature was removed, now always available. 160- [Updated public dependences][110]: 161 - `rand` support has been updated to 0.7, requiring Rust 1.32. 162 - `quickcheck` support has been updated to 0.9, requiring Rust 1.34. 163- [Removed `impl Neg for BigUint`][145], which only ever panicked. 164- [Bit counts are now `u64` instead of `usize`][143]. 165 166**Contributors**: @cuviper, @dignifiedquire, @hansihe, 167@kpcyrd, @milesand, @tech6hutch 168 169[62]: https://github.com/rust-num/num-bigint/pull/62 170[101]: https://github.com/rust-num/num-bigint/pull/101 171[110]: https://github.com/rust-num/num-bigint/pull/110 172[123]: https://github.com/rust-num/num-bigint/pull/123 173[137]: https://github.com/rust-num/num-bigint/pull/137 174[142]: https://github.com/rust-num/num-bigint/pull/142 175[143]: https://github.com/rust-num/num-bigint/pull/143 176[145]: https://github.com/rust-num/num-bigint/pull/145 177 178# Release 0.2.6 (2020-01-27) 179 180- [Fix the promotion of negative `isize` in `BigInt` assign-ops][133]. 181 182**Contributors**: @cuviper, @HactarCE 183 184[133]: https://github.com/rust-num/num-bigint/pull/133 185 186# Release 0.2.5 (2020-01-09) 187 188- [Updated the `autocfg` build dependency to 1.0][126]. 189 190**Contributors**: @cuviper, @tspiteri 191 192[126]: https://github.com/rust-num/num-bigint/pull/126 193 194# Release 0.2.4 (2020-01-01) 195 196- [The new `BigUint::to_u32_digits` method][104] returns the number as a 197 little-endian vector of base-2<sup>32</sup> digits. The same method on 198 `BigInt` also returns the sign. 199- [`BigUint::modpow` now applies a modulus even for exponent 1][113], which 200 also affects `BigInt::modpow`. 201- [`BigInt::modpow` now returns the correct sign for negative bases with even 202 exponents][114]. 203 204[104]: https://github.com/rust-num/num-bigint/pull/104 205[113]: https://github.com/rust-num/num-bigint/pull/113 206[114]: https://github.com/rust-num/num-bigint/pull/114 207 208**Contributors**: @alex-ozdemir, @cuviper, @dingelish, @Speedy37, @youknowone 209 210# Release 0.2.3 (2019-09-03) 211 212- [`Pow` is now implemented for `BigUint` exponents][77]. 213- [The optional `quickcheck` feature enables implementations of `Arbitrary`][99]. 214- See the [full comparison][compare-0.2.3] for performance enhancements and more! 215 216[77]: https://github.com/rust-num/num-bigint/pull/77 217[99]: https://github.com/rust-num/num-bigint/pull/99 218[compare-0.2.3]: https://github.com/rust-num/num-bigint/compare/num-bigint-0.2.2...num-bigint-0.2.3 219 220**Contributors**: @cuviper, @lcnr, @maxbla, @mikelodder7, @mikong, 221@TheLetterTheta, @tspiteri, @XAMPPRocky, @youknowone 222 223# Release 0.2.2 (2018-12-14) 224 225- [The `Roots` implementations now use better initial guesses][71]. 226- [Fixed `to_signed_bytes_*` for some positive numbers][72], where the 227 most-significant byte is `0x80` and the rest are `0`. 228 229[71]: https://github.com/rust-num/num-bigint/pull/71 230[72]: https://github.com/rust-num/num-bigint/pull/72 231 232**Contributors**: @cuviper, @leodasvacas 233 234# Release 0.2.1 (2018-11-02) 235 236- [`RandBigInt` now uses `Rng::fill_bytes`][53] to improve performance, instead 237 of repeated `gen::<u32>` calls. The also affects the implementations of the 238 other `rand` traits. This may potentially change the values produced by some 239 seeded RNGs on previous versions, but the values were tested to be stable 240 with `ChaChaRng`, `IsaacRng`, and `XorShiftRng`. 241- [`BigInt` and `BigUint` now implement `num_integer::Roots`][56]. 242- [`BigInt` and `BigUint` now implement `num_traits::Pow`][54]. 243- [`BigInt` and `BigUint` now implement operators with 128-bit integers][64]. 244 245**Contributors**: @cuviper, @dignifiedquire, @mancabizjak, @Robbepop, 246@TheIronBorn, @thomwiggers 247 248[53]: https://github.com/rust-num/num-bigint/pull/53 249[54]: https://github.com/rust-num/num-bigint/pull/54 250[56]: https://github.com/rust-num/num-bigint/pull/56 251[64]: https://github.com/rust-num/num-bigint/pull/64 252 253# Release 0.2.0 (2018-05-25) 254 255### Enhancements 256 257- [`BigInt` and `BigUint` now implement `Product` and `Sum`][22] for iterators 258 of any item that we can `Mul` and `Add`, respectively. For example, a 259 factorial can now be simply: `let f: BigUint = (1u32..1000).product();` 260- [`BigInt` now supports two's-complement logic operations][26], namely 261 `BitAnd`, `BitOr`, `BitXor`, and `Not`. These act conceptually as if each 262 number had an infinite prefix of `0` or `1` bits for positive or negative. 263- [`BigInt` now supports assignment operators][41] like `AddAssign`. 264- [`BigInt` and `BigUint` now support conversions with `i128` and `u128`][44], 265 if sufficient compiler support is detected. 266- [`BigInt` and `BigUint` now implement rand's `SampleUniform` trait][48], and 267 [a custom `RandomBits` distribution samples by bit size][49]. 268- The release also includes other miscellaneous improvements to performance. 269 270### Breaking Changes 271 272- [`num-bigint` now requires rustc 1.15 or greater][23]. 273- [The crate now has a `std` feature, and won't build without it][46]. This is 274 in preparation for someday supporting `#![no_std]` with `alloc`. 275- [The `serde` dependency has been updated to 1.0][24], still disabled by 276 default. The `rustc-serialize` crate is no longer supported by `num-bigint`. 277- [The `rand` dependency has been updated to 0.5][48], now disabled by default. 278 This requires rustc 1.22 or greater for `rand`'s own requirement. 279- [`Shr for BigInt` now rounds down][8] rather than toward zero, matching the 280 behavior of the primitive integers for negative values. 281- [`ParseBigIntError` is now an opaque type][37]. 282- [The `big_digit` module is no longer public][38], nor are the `BigDigit` and 283 `DoubleBigDigit` types and `ZERO_BIG_DIGIT` constant that were re-exported in 284 the crate root. Public APIs which deal in digits, like `BigUint::from_slice`, 285 will now always be base-`u32`. 286 287**Contributors**: @clarcharr, @cuviper, @dodomorandi, @tiehuis, @tspiteri 288 289[8]: https://github.com/rust-num/num-bigint/pull/8 290[22]: https://github.com/rust-num/num-bigint/pull/22 291[23]: https://github.com/rust-num/num-bigint/pull/23 292[24]: https://github.com/rust-num/num-bigint/pull/24 293[26]: https://github.com/rust-num/num-bigint/pull/26 294[37]: https://github.com/rust-num/num-bigint/pull/37 295[38]: https://github.com/rust-num/num-bigint/pull/38 296[41]: https://github.com/rust-num/num-bigint/pull/41 297[44]: https://github.com/rust-num/num-bigint/pull/44 298[46]: https://github.com/rust-num/num-bigint/pull/46 299[48]: https://github.com/rust-num/num-bigint/pull/48 300[49]: https://github.com/rust-num/num-bigint/pull/49 301 302# Release 0.1.44 (2018-05-14) 303 304- [Division with single-digit divisors is now much faster.][42] 305- The README now compares [`ramp`, `rug`, `rust-gmp`][20], and [`apint`][21]. 306 307**Contributors**: @cuviper, @Robbepop 308 309[20]: https://github.com/rust-num/num-bigint/pull/20 310[21]: https://github.com/rust-num/num-bigint/pull/21 311[42]: https://github.com/rust-num/num-bigint/pull/42 312 313# Release 0.1.43 (2018-02-08) 314 315- [The new `BigInt::modpow`][18] performs signed modular exponentiation, using 316 the existing `BigUint::modpow` and rounding negatives similar to `mod_floor`. 317 318**Contributors**: @cuviper 319 320[18]: https://github.com/rust-num/num-bigint/pull/18 321 322 323# Release 0.1.42 (2018-02-07) 324 325- [num-bigint now has its own source repository][num-356] at [rust-num/num-bigint][home]. 326- [`lcm` now avoids creating a large intermediate product][num-350]. 327- [`gcd` now uses Stein's algorithm][15] with faster shifts instead of division. 328- [`rand` support is now extended to 0.4][11] (while still allowing 0.3). 329 330**Contributors**: @cuviper, @Emerentius, @ignatenkobrain, @mhogrefe 331 332[home]: https://github.com/rust-num/num-bigint 333[num-350]: https://github.com/rust-num/num/pull/350 334[num-356]: https://github.com/rust-num/num/pull/356 335[11]: https://github.com/rust-num/num-bigint/pull/11 336[15]: https://github.com/rust-num/num-bigint/pull/15 337 338 339# Prior releases 340 341No prior release notes were kept. Thanks all the same to the many 342contributors that have made this crate what it is! 343 344