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