Skip to content

Releases: brick/math

0.8.17

19 Aug 08:33
Compare
Choose a tag to compare

🐛 Bug fix

  • BigInteger::toBytes() could return an incorrect binary representation for some numbers
  • The bitwise operations and(), or(), xor() on BigInteger could return an incorrect result when the GMP extension is not available

0.8.16

18 Aug 09:04
Compare
Choose a tag to compare

🚑 Critical fix

  • This version reintroduces the deprecated BigInteger::parse() method, that has been removed by mistake in version 0.8.9 and should have lasted for the whole 0.8 release cycle.

New features

  • BigInteger::modInverse() calculates a modular multiplicative inverse
  • BigInteger::fromBytes() creates a BigInteger from a byte string
  • BigInteger::toBytes() converts a BigInteger to a byte string
  • BigInteger::randomBits() creates a pseudo-random BigInteger of a given bit length
  • BigInteger::randomRange() creates a pseudo-random BigInteger between two bounds

💩 Deprecations

  • BigInteger::powerMod() is now deprecated in favour of modPow()

0.8.15

15 Apr 16:07
Compare
Choose a tag to compare

🐛 Fixes

  • added missing ext-json requirement, due to BigNumber implementing JsonSerializable

⚡️ Optimizations

  • additional optimization in BigInteger::remainder()

0.8.14

18 Feb 14:17
6f7a46b
Compare
Choose a tag to compare

New features

  • BigInteger::getLowestSetBit() returns the index of the rightmost one bit

0.8.13

16 Feb 17:36
Compare
Choose a tag to compare

New features

  • BigInteger::isEven() tests whether the number is even
  • BigInteger::isOdd() tests whether the number is odd
  • BigInteger::testBit() tests if a bit is set
  • BigInteger::getBitLength() returns the number of bits in the minimal representation of the number

0.8.12

03 Feb 21:53
Compare
Choose a tag to compare

🛠️ Maintenance release

Classes are now annotated for better static analysis with psalm.

This is a maintenance release: no bug fixes, no new features, no breaking changes.

0.8.11

23 Jan 00:35
Compare
Choose a tag to compare

New feature

BigInteger::powerMod() performs a power-with-modulo operation. Useful for crypto.

0.8.10

21 Jan 21:33
Compare
Choose a tag to compare

New feature

BigInteger::mod() returns the modulo of two numbers. The modulo differs from the remainder when the signs of the operands are different.

0.8.9

08 Jan 09:44
Compare
Choose a tag to compare

⚡️ Performance improvements

A few additional optimizations in BigInteger and BigDecimal when one of the operands can be returned as is. Thanks to @tomtomsen in #24.

0.8.8

25 Apr 15:21
Compare
Choose a tag to compare

🐛 Bug fixes

  • BigInteger::toBase() could return an empty string for zero values (BCMath & Native calculators only, GMP calculator unaffected)

New features

  • BigInteger::toArbitraryBase() converts a number to an arbitrary base, using a custom alphabet
  • BigInteger::fromArbitraryBase() converts a string in an arbitrary base, using a custom alphabet, back to a number

These methods can be used as the foundation to convert strings between different bases/alphabets, using BigInteger as an intermediate representation.

💩 Deprecations

  • BigInteger::parse() is now deprecated in favour of fromBase()

BigInteger::fromBase() works the same way as parse(), with 2 minor differences:

  • the $base parameter is required, it does not default to 10
  • it throws a NumberFormatException instead of an InvalidArgumentException when the number is malformed