NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #41 most downloaded on Packagist
Arbitrary-precision arithmetic library
Last release 23 days ago
12 Sep 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
80 releases · first in 2014
BigNumber classes now implement JsonSerializable. The JSON output is always a string.
BigNumber classes now implement JsonSerializable.
The JSON output is always a string.
This is a bugfix release. Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted
This is a bugfix release. Dividing by a negative power of 1 with the same scale as the dividend could trigger an incorrect optimization which resulted in a wrong result. See #6.
One column per quarter.
The $scale parameter of BigDecimal::dividedBy() is now optional again.
The $scale parameter of BigDecimal::dividedBy() is now optional again.
New method: `BigNumber::toScale()`
New method: BigNumber::toScale()
This allows to convert any BigNumber to a BigDecimal with a given scale, using rounding if necessary.
Common BigNumber interface for all classes, with the following methods:
New features
BigNumber interface for all classes, with the following methods:
sign() and derived methods (isZero(), isPositive(), ...)compareTo() and derived methods (isEqualTo(), isGreaterThan(), ...) that work across different BigNumber typestoBigInteger(), toBigDecimal(), toBigRational() conversion methodstoInteger() and toFloat() conversion methods to native typesof() behaviour: every class now accepts any type of number, provided that it can be safely converted to the current typeBigDecimal::exactlyDividedBy(); this method automatically computes the scale of the result, provided that the division yields a finite number of digitsBigRational::quotient() and remainder()DivisionByZeroException, RoundingNecessaryException, NumberFormatExceptionzero(), one() and ten() available in all classesBigInteger::dividedBy()This release also comes with many performance improvements.
Breaking changes
BigInteger:
getSign() is renamed to sign()toString() is renamed to toBase()BigInteger::dividedBy() now throws an exception by default if the remainder is not zero; use quotient() to get the previous behaviourBigDecimal:
getSign() is renamed to sign()getUnscaledValue() is renamed to unscaledValue()getScale() is renamed to scale()getIntegral() is renamed to integral()getFraction() is renamed to fraction()divideAndRemainder() is renamed to quotientAndRemainder()dividedBy() now takes a mandatory $scale parameter before the rounding modetoBigInteger() does not accept a $roundingMode parameter anymoretoBigRational() does not simplify the fraction anymore; explicitly add ->simplified() to get the previous behaviourBigRational:
getSign() is renamed to sign()getNumerator() is renamed to numerator()getDenominator() is renamed to denominator()of() is renamed to nd(), while parse() is renamed to of()ArithmeticException is moved to an Exception\ sub-namespaceof() factory methods now throw NumberFormatException instead of InvalidArgumentExceptionBackport of two bug fixes from the 0.5 branch:
Backport of two bug fixes from the 0.5 branch:
BigInteger::parse() did not always throw InvalidArgumentException as expectedNew method: BigDecimal::stripTrailingZeros()
New method: BigDecimal::stripTrailingZeros()
Introducing a BigRational class, to perform calculations on fractions of any size.
Introducing a BigRational class, to perform calculations on fractions of any size.
Rounding modes have been removed from BigInteger, and are now a concept specific to BigDecimal.
Rounding modes have been removed from BigInteger, and are now a concept specific to BigDecimal.
BigInteger::dividedBy() now always returns the quotient of the division.
Backport of two bug fixes from the 0.5 branch:
Backport of two bug fixes from the 0.5 branch:
BigInteger::parse() did not always throw InvalidArgumentException as expectedBigInteger::remainder() returns the remainder of a division only
New methods:
BigInteger::remainder() returns the remainder of a division onlyBigInteger::gcd() returns the greatest common divisor of two numbersFix toString() not handling negative numbers.
Fix toString() not handling negative numbers.
BigInteger and BigDecimal now have a getSign() method that returns:
BigInteger and BigDecimal now have a getSign() method that returns:
-1 if the number is negative0 if the number is zero1 if the number is positiveMinor performance improvements
Minor performance improvements
The $roundingMode and $scale parameters have been swapped in BigDecimal::dividedBy().
The $roundingMode and $scale parameters have been swapped in BigDecimal::dividedBy().
Stronger immutability guarantee for BigInteger and BigDecimal.
Stronger immutability guarantee for BigInteger and BigDecimal.
So far, it would have been possible to break immutability of these classes by calling the unserialize() internal function. This release fixes that.
Added BigDecimal::divideAndRemainder()
Added BigDecimal::divideAndRemainder()
min() and max() do not accept an array anymore, but a variable number of parameters
min() and max() do not accept an array anymore, but a variable number of parameters- Added BigInteger::power() - Added HHVM support
BigInteger::power()First beta release.
First beta release.
Your coding agent can read these notes before it upgrades. Set up the MCP server →