Skip to content

Releases: isaacholt100/bnum

v0.12.1

01 Jan 20:45
06b76ff
Compare
Choose a tag to compare

This release fixes a few incorrect implementations of some methods.

Patches

  • Fixed #47, by making midpoint round to zero for signed integers.
  • Changed the Debug implementation of ParseIntError to match that of core::num::ParseIntError.
  • Fixed the lcm method on num-integer::Integer for signed integers (now always returns non-negative values)
  • Corrected more cases where a PosOverflow error is returned instead of an InvalidDigit error when parsing integers (however there some edge cases where PosOverflow should be returned and now isn't, this will be fixed at some point).

Auto-generated release notes:

What's Changed

Full Changelog: v0.12.0...v0.12.1

v0.12.0

20 Sep 14:07
eeefc69
Compare
Choose a tag to compare

This release introduces a number of new methods, as well as support for the borsh crate.

Major Changes

  • The latest nightly compiler (1.83.0) does not support user-defined const traits, and so the nightly crate feature no longer makes the CastFrom and As traits const. This means the implementations of these traits on bnum integers are no longer const either.

Minor Changes

  • Added (optional) support for the borsh crate (this enables serialisation and deserialisation using this crate).
  • Added digits_mut and set_bit methods to unsigned integers, allowing for manipulation without copying the value.
  • Added cast_signed method for unsigned integers and cast_unsigned method for signed integers.
  • Added midpoint method for all integers.
  • Added carrying_add and borrowing_sub methods for signed integers.
  • Added strict_... arithmetic methods for all integers.

Patches

  • Added (bnum) prefix to panic messages that mistakenly did not include it.

Auto-generated release notes:

What's Changed

New Contributors

Full Changelog: v0.11.0...v0.12.0

v0.11.0

06 Mar 21:37
d715a3e
Compare
Choose a tag to compare

This release fixes #39, and makes all ilog* methods panic with the same message as Rust's primitive integers (with the (bnum) prefix, as for other bnum panic messages).

Major Changes

  • ilog* methods now panic for invalid inputs in release mode as well as debug mode.

Patches

  • ilog* panic messages now match that of Rust's primitives.

What's Changed

Full Changelog: v0.10.0...v0.11.0

v0.8.1

24 Nov 10:01
Compare
Choose a tag to compare

This release fixes #36. For more info, see the release notes for v0.10.0.

v0.10.0

23 Nov 22:19
f1520e5
Compare
Choose a tag to compare

This release fixes #36, which was related to a premature stabilisation of the language feature const_intrinsic_copy (see rust-lang/rust#117905). Previously, several functions had relied on this feature, which meant their implementations contained Undefined Behaviour. (For a list of those affected and for further details, see changes/prior-bugs.md). Completely safe implementations have now been written for these functions.

This is marked as a major change as previous versions v0.7.0 - v0.9.1 may at some point cease to be compatible with the latest version of the Rust compiler, if stabilisation of const_intrinsic_copy is reverted.

What's Changed

Full Changelog: v0.9.1...v0.10.0

v0.9.1

25 Oct 18:06
6e26ddb
Compare
Choose a tag to compare

Patches

The only change in this version is the addition of the rust-version (MSRV) field to Cargo.toml. The MSRV is currently 1.65.0.

What's Changed

New Contributors

Full Changelog: v0.9.0...v0.9.1

v0.9.0

28 Sep 15:14
ab5cb86
Compare
Choose a tag to compare

Changes in v0.9.0

Major Changes

  • bnum integers are now #[repr(transparent)], which solves #30.
  • The Slice struct is now #[repr(transparent)].
  • The bnum wrapping_rem method now has the same panic message as wrapping_rem on primitive integers.
  • unchecked_shl and unchecked_shr now take a u32 as the shifting argument instead of Self.
  • The implementations of unchecked_shl and unchecked_shr for bnum integers with 64-bit digits were previously incorrect; they have now been fixed.
  • The implementation of Add<$Digit> on all bnum unsigned integers was previously incorrect; it has now been fixed.
  • The lcm method on bnum integers no longer panics if self is zero; instead, it returns zero.

Minor Changes

  • Added optional zeroize support.
  • Added optional quickcheck support.
  • Added optional valuable support.
  • Change from manual implementation of PartialEq and Eq to #[derive(PartialEq, Eq)]: this fixes #32.
  • Added trait BTryFrom for fallible conversions between bnum integers - this is a temporary solution to #31.
  • Don't require the std_rng and small_rng features of the rand crate except when testing.

Patches

Auto release notes

Full Changelog: v0.8.0...v0.9.0

v0.8.0

23 Jul 18:52
fdff946
Compare
Choose a tag to compare

Breaking Changes

There are no breaking changes in this release.

Other Changes

  • The following methods on all unsigned and signed integers are now const on stable: checked_div, checked_div_euclid, checked_rem, checked_rem_euclid, checked_next_multiple_of, checked_ilog10, checked_ilog, div, rem, overflowing_div, overflowing_div_euclid, overflowing_rem, overflowing_rem_euclid, saturating_div, wrapping_div, wrapping_div_euclid, wrapping_rem, wrapping_rem_euclid, div_euclid, rem_euclid, ilog10, ilog, next_multiple_of, div_floor, div_ceil.
  • It is now possible to cast between bnum integers of different digit sizes: for example, you can cast to and from BUint<5> to BIntD16<7>.
  • Issue #25 has been fixed, which means that all formatting trait implementations should now match those for primitive integers (in previous versions, some formatting traits ignored formatting options such as zero padding).

What's Changed

Full Changelog: v0.7.0...v0.8.0

v0.7.0

28 May 17:02
9f4a08f
Compare
Choose a tag to compare

Breaking changes

  • Unfortunately version 1.71.0 of the nightly Rust compiler dropped support of the const implementation of common standard library traits. Previous to this version, bnum had const implementations of many standard library traits such as Add, BitOr, PartialEq, etc. which were available using nightly. However, now this is no longer possible with the current version of the nightly Rust compiler (as of 28th May 2023), hence the const implementations of these traits have been dropped for now to allow compatibility with the latest version on nightly. To account for this, many of the methods defined on these traits now have const implementations on the integer types themselves - so for example, there are now BUint::shr and BInt::shr methods which are const.

Other changes

  • The (non-default) arbitrary feature has been introduced, which derives the Arbitrary trait from the arbitrary crate. Note that normally bnum works with no_std, but it cannot with this feature enabled.
  • The following methods are now const on stable: abs_diff, <uint>::{overflowing_neg, wrapping_neg}, wrapping_{shr, shl}, overflowing_{shr, shl}, checked_{shr, shl}, rotate_left, rotate_right, from_be_slice, from_le_slice.

(@lrubasze contributed the addition of the arbitrary support in this release - due to a complication with the CI with his pull request, I'm mentioning him here so he is included in this list of contributors).

What's Changed

Full Changelog: v0.6.0...v0.7.0

v0.6.0

07 Mar 14:08
cb9df63
Compare
Choose a tag to compare

There were no breaking changes in this release. The biggest update is the introduction of the const parse_str_radix method on signed and unsigned integers, which allows compile-time parsing of string literals in a given radix. from_str_radix is now also const, which allows compile-time parsing of string literals which are not guaranteed to parse successfully.

The following methods are now const on stable:

  • {BUint, BInt}::parse_bytes
  • BInt::overflowing_mul
  • BInt::overflowing_neg
  • BInt::overflowing_abs
  • BInt::overflowing_pow
  • BInt::wrapping_neg
  • BInt::wrapping_abs
  • BInt::checked_mul
  • BInt::checked_neg
  • BInt::checked_abs
  • BInt::checked_pow
  • BInt::saturating_mul
  • BInt::saturating_neg
  • BInt::saturating_abs
  • BInt::saturating_pow
  • BInt::unsigned_abs
  • BInt::pow
  • BInt::abs
  • BInt::abs_diff

Additionally, the following methods are now const when the nightly feature is enabled:

  • {BUint, BInt}::from_radix_be
  • {BUint, BInt}::from_radix_le

What's Changed

Full Changelog: v0.5.0...v0.6.0