Releases: brick/math
Releases · brick/math
0.8.17
0.8.16
🚑 Critical fix
- This version reintroduces the deprecated
BigInteger::parse()
method, that has been removed by mistake in version0.8.9
and should have lasted for the whole0.8
release cycle.
✨ New features
BigInteger::modInverse()
calculates a modular multiplicative inverseBigInteger::fromBytes()
creates aBigInteger
from a byte stringBigInteger::toBytes()
converts aBigInteger
to a byte stringBigInteger::randomBits()
creates a pseudo-randomBigInteger
of a given bit lengthBigInteger::randomRange()
creates a pseudo-randomBigInteger
between two bounds
💩 Deprecations
BigInteger::powerMod()
is now deprecated in favour ofmodPow()
0.8.15
0.8.14
0.8.13
✨ New features
BigInteger::isEven()
tests whether the number is evenBigInteger::isOdd()
tests whether the number is oddBigInteger::testBit()
tests if a bit is setBigInteger::getBitLength()
returns the number of bits in the minimal representation of the number
0.8.12
0.8.11
0.8.10
0.8.9
0.8.8
🐛 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 alphabetBigInteger::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 offromBase()
BigInteger::fromBase()
works the same way as parse()
, with 2 minor differences:
- the
$base
parameter is required, it does not default to10
- it throws a
NumberFormatException
instead of anInvalidArgumentException
when the number is malformed