Skip to content

0.8.8

Compare
Choose a tag to compare
@BenMorel BenMorel released this 25 Apr 15:21
· 234 commits to master since this release

πŸ› 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