Releases: brick/math
Releases Β· brick/math
Release list
0.20.0
π₯ Breaking changes
- Deprecated exception class
UnsupportedPlatformExceptionhas been removed, catchPlatformExceptioninstead
The following breaking change only affects you if you specifically catch DivisionByZeroException around calls to of() or to any method accepting strings:
of()now throwsNumberFormatExceptioninstead ofDivisionByZeroExceptionwhen the string is a fraction with a denominator of zero, such as'2/0'
β¨ New features
- New methods:
parse()andparseNullable()safely parse untrusted input, by restricting the allowed syntax and limiting the number of digits - New enum:
NumberSyntaxlists the syntax features thatparse()can accept, with constants for the most common combinations
π Bug fixes
of()no longer throwsPlatformExceptionon malformed input with many digits, crafted to trigger heavy backtracking in its parser; such input now throwsNumberFormatExceptionas documented
π Improvements
NumberFormatExceptionmessages now escape control and non-ASCII characters, and truncate values longer than 40 bytes, instead of copying the raw input into the message
0.19.1
β¨ New features
- New exception class:
PlatformException(replacesUnsupportedPlatformException) PlatformExceptionis now thrown whenpreg_match()fails due to improper PHP configurationPlatformExceptionis now thrown whenPHP_INT_SIZEis an unsupported value
ποΈ Deprecations
- Exception class
UnsupportedPlatformExceptionis deprecated; catchPlatformExceptioninstead
0.19.0
0.18.0
π₯ Breaking changes
The following breaking change only affects you if you're using named arguments:
BigInteger::fromBytes()now uses$bytesas the parameter name
π Bug fixes
of()no longer accepts a trailing newline (\n) in the input string; such input now throwsNumberFormatExceptionof()now consistently throwsNumberFormatExceptionfor exponents too large to process, instead ofIntegerOverflowExceptionin some casesBigInteger::fromBase()now reports the invalid character with its original case in theNumberFormatExceptionmessage, instead of lower-casing it
β‘οΈ Performance improvements
BigInteger::gcd()no longer exhausts memory on large inputs when the GMP extension is not installedBigInteger::modInverse()no longer exhausts memory on large inputs, and is faster when the GMP extension is not installed
π Static analysis improvements
- Narrowed parameter and return types with static analysis annotations:
nthRoot()'s$nis nowpositive-intBigInteger::toBase(),toArbitraryBase(),toBytes()andBigRational::toRepeatingDecimalString()now returnnon-empty-string
0.17.2
0.17.1
0.17.0
π₯ Breaking changes
- Deprecated method
BigDecimal::hasNonZeroFractionalPart()has been removed, use! $number->getFractionalPart()->isZero()instead - Exception constructors and factory methods are now
@internal
β¨ Compatibility improvements
BigDecimal::fromFloatExact()now supports 32-bit PHP
0.16.2
0.16.1
0.16.0
π₯ Breaking changes
BigInteger::getLowestSetBit()now returnsnullinstead of-1when the number is zero- Deprecated method
BigRational::simplified()has been removed, as it is now a no-op
β¨ New features
- New method:
BigDecimal::getIntegralPart()returns the integral part asBigInteger(this method existed with a different signature in version 0.14, and was removed in 0.15) - New method:
BigDecimal::getFractionalPart()returns the fractional part asBigDecimal(this method existed with a different signature and meaning in version 0.14, and was removed in 0.15)
ποΈ Deprecations
- Method
BigDecimal::hasNonZeroFractionalPart()is deprecated, use->getFractionalPart()->isZero()instead