Skip to content

Releases: brick/math

0.8.7

20 Apr 22:39
Compare
Choose a tag to compare

Improvements

  • Safer conversion from float when using custom locales
  • Much faster NativeCalculator implementation 🚀

You can expect at least a 3x performance improvement for common arithmetic operations when using the library on systems without GMP or BCMath; it gets exponentially faster on multiplications with a high number of digits. This is due to calculations now being performed on whole blocks of digits (the block size depending on the platform, 32-bit or 64-bit) instead of digit-by-digit as before.

0.8.6

11 Apr 12:51
Compare
Choose a tag to compare

New method

BigNumber::sum() returns the sum of one or more numbers.

0.8.5

12 Feb 11:32
Compare
Choose a tag to compare

Bug fix: of() factory methods could fail when passing a float in environments using a LC_NUMERIC locale with a decimal separator other than '.' (#20).

Thanks @manowark 👍

0.8.4

07 Dec 15:17
Compare
Choose a tag to compare

New method

BigDecimal::sqrt() calculates the square root of a decimal number, to a given scale.

0.8.3

06 Dec 12:47
Compare
Choose a tag to compare

New method

BigInteger::sqrt() calculates the square root of a number (thanks @peter279k).

New exception

NegativeNumberException is thrown when calling sqrt() on a negative number.

0.8.2

08 Nov 09:54
Compare
Choose a tag to compare

Performance update

  • Further improvement of toInt() performance
  • NativeCalculator can now perform some multiplications more efficiently

0.8.1

07 Nov 22:19
Compare
Choose a tag to compare

Performance optimization of toInt() methods.

0.8.0

13 Oct 16:56
Compare
Choose a tag to compare

Breaking changes

The following deprecated methods have been removed. Use the new method name instead:

Method removed Replacement method
BigDecimal::getIntegral() BigDecimal::getIntegralPart()
BigDecimal::getFraction() BigDecimal::getFractionalPart()

New features

BigInteger has been augmented with 5 new methods for bitwise operations:

New method Description
and() performs a bitwise AND operation on two numbers
or() performs a bitwise OR operation on two numbers
xor() performs a bitwise XOR operation on two numbers
shiftedLeft() returns the number shifted left by a number of bits
shiftedRight() returns the number shifted right by a number of bits

Thanks to @DASPRiD 👍

0.7.3

20 Aug 20:59
Compare
Choose a tag to compare

New method: BigDecimal::hasNonZeroFractionalPart()

Renamed/deprecated methods:

  • BigDecimal::getIntegral() has been renamed to getIntegralPart() and is now deprecated
  • BigDecimal::getFraction() has been renamed to getFractionalPart() and is now deprecated

0.7.2

21 Jul 23:35
Compare
Choose a tag to compare

Performance update

BigInteger::parse() and toBase() now use GMP's built-in base conversion features when available.