Arbitrary-precision arithmetic library for PHP
⚡️ Performance improvements
BigNumber::of()
is now faster, thanks to @SebastienDug in #77.💥 Breaking changes
RoundingMode
is now an enum
; if you're type-hinting rounding modes, you need to type-hint against RoundingMode
instead of int
nowBigNumber
classes do not implement the Serializable
interface anymore (they use the new custom object serialization mechanism)BigNumber
subclasses:
BigNumber::of()
is now static
BigNumber
has a new abstract method from()
public
and protected
functions of BigNumber
are now final
💥 Breaking changes
MathException
now extends Exception
instead of RuntimeException
* You may now run into type errors if you were passing Stringable
objects to of()
or any of the methods internally calling of()
, with strict_types
enabled. You can fix this by casting Stringable
objects to string
first.
👌 Improvements
BigRational::toFloat()
now simplifies the fraction before performing division (#73) thanks to @olsavmic✨ New features
BigInteger::gcdMultiple()
returns the GCD of multiple BigInteger
numbers💥 Breaking changes
🚀 Compatibility with PHP 8.1
Serializable
interface being deprecated (#60) thanks @TRowbotham:bug: Bug fix
bcscale()
, on PHP >= 7.2 (#55).✨ New features
BigInteger::not()
returns the bitwise NOT
value🐛 Bug fixes
BigInteger::toBytes()
could return an incorrect binary representation for some numbersand()
, or()
, xor()
on BigInteger
could return an incorrect result when the GMP extension is not available🐛 Bug fix
BigInteger::toBytes()
could return an incorrect binary representation for some numbersand()
, or()
, xor()
on BigInteger
could return an incorrect result when the GMP extension is not available