Skip to content

Releases: brick/math

0.14.1

24 Nov 14:42

Choose a tag to compare

New features

  • New method: BigNumber::ofNullable() (#94 by @mrkh995)

Compatibility fixes

0.14.0

29 Aug 12:50

Choose a tag to compare

New features

  • New methods: BigInteger::clamp() and BigDecimal::clamp() (#96 by @JesterIruka)

Improvements

  • All pure methods in BigNumber classes are now marked as @pure for better static analysis

💥 Breaking changes

  • Minimum PHP version is now 8.2
  • BigNumber classes are now readonly
  • BigNumber is now marked as sealed: it must not be extended outside of this package
  • Exception classes are now final

0.13.1

29 Mar 13:51

Choose a tag to compare

Improvements

  • __toString() methods of BigInteger and BigDecimal are now type-hinted as returning numeric-string instead of string (#90 by @vudaltsov)

0.13.0

03 Mar 13:22

Choose a tag to compare

💥 Breaking changes

  • BigDecimal::ofUnscaledValue() no longer throws an exception if the scale is negative
  • MathException now extends RuntimeException instead of Exception; this reverts the change introduced in version 0.11.0 (#82)

New features

  • BigDecimal::ofUnscaledValue() allows a negative scale (and converts the values to create a zero scale number)

0.12.3

28 Feb 13:12

Choose a tag to compare

New features

  • BigDecimal::getPrecision() returns the number of significant digits in a decimal number

0.12.2

26 Feb 10:24

Choose a tag to compare

⚡️ Performance improvements

  • Division in NativeCalculator is now faster for small divisors, thanks to @Izumi-kun in #87

👌 Improvements

  • Add missing RoundingNecessaryException to the @throws annotation of BigNumber::of()

0.12.1

29 Nov 23:22

Choose a tag to compare

⚡️ Performance improvements

0.12.0

26 Nov 14:45

Choose a tag to compare

💥 Breaking changes

  • Minimum PHP version is now 8.1
  • RoundingMode is now an enum; if you're type-hinting rounding modes, you need to type-hint against RoundingMode instead of int now
  • BigNumber classes do not implement the Serializable interface anymore (they use the new custom object serialization mechanism)
  • The following breaking changes only affect you if you're creating your own BigNumber subclasses:
    • the return type of BigNumber::of() is now static
    • BigNumber has a new abstract method from()
    • all public and protected functions of BigNumber are now final

0.11.0

15 Jan 23:17

Choose a tag to compare

💥 Breaking changes

  • Minimum PHP version is now 8.0
  • Methods accepting a union of types are now strongly typed*
  • 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.

0.10.2

10 Aug 22:54
459f278

Choose a tag to compare

👌 Improvements

  • BigRational::toFloat() now simplifies the fraction before performing division (#73) thanks to @olsavmic