src
3 years ago
CHANGELOG.md
3 years ago
LICENSE
3 years ago
SECURITY.md
3 years ago
composer.json
3 years ago
CHANGELOG.md
416 lines
| 1 | # Changelog |
| 2 | |
| 3 | All notable changes to this project will be documented in this file. |
| 4 | |
| 5 | ## [](https://github.com/brick/math/releases/tag/0.9.30.9.3](https://github.com/brick/math/releases/tag/0.9.3](https://github.com/brick/math/releases/tag/0.9.3) - 2021-08-15 |
| 6 | |
| 7 | 🚀 **Compatibility with PHP 8.1** |
| 8 | |
| 9 | - Support for custom object serialization; this removes a warning on PHP 8.1 due to the `Serializable` interface being deprecated (thanks @TRowbotham) |
| 10 | |
| 11 | ## [](https://github.com/brick/math/releases/tag/0.9.20.9.2](https://github.com/brick/math/releases/tag/0.9.2](https://github.com/brick/math/releases/tag/0.9.2) - 2021-01-20 |
| 12 | |
| 13 | 🐛 **Bug fix** |
| 14 | |
| 15 | - Incorrect results could be returned when using the BCMath calculator, with a default scale set with `bcscale()`, on PHP >= 7.2 (#55). |
| 16 | |
| 17 | ## [](https://github.com/brick/math/releases/tag/0.9.10.9.1](https://github.com/brick/math/releases/tag/0.9.1](https://github.com/brick/math/releases/tag/0.9.1) - 2020-08-19 |
| 18 | |
| 19 | ✨ New features |
| 20 | |
| 21 | - `BigInteger::not()` returns the bitwise `NOT` value |
| 22 | |
| 23 | 🐛 **Bug fixes** |
| 24 | |
| 25 | - `BigInteger::toBytes()` could return an incorrect binary representation for some numbers |
| 26 | - The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available |
| 27 | |
| 28 | ## [](https://github.com/brick/math/releases/tag/0.9.00.9.0](https://github.com/brick/math/releases/tag/0.9.0](https://github.com/brick/math/releases/tag/0.9.0) - 2020-08-18 |
| 29 | |
| 30 | 👌 **Improvements** |
| 31 | |
| 32 | - `BigNumber::of()` now accepts `.123` and `123.` formats, both of which return a `BigDecimal` |
| 33 | |
| 34 | 💥 **Breaking changes** |
| 35 | |
| 36 | - Deprecated method `BigInteger::powerMod()` has been removed - use `modPow()` instead |
| 37 | - Deprecated method `BigInteger::parse()` has been removed - use `fromBase()` instead |
| 38 | |
| 39 | ## [](https://github.com/brick/math/releases/tag/0.8.170.8.17](https://github.com/brick/math/releases/tag/0.8.17](https://github.com/brick/math/releases/tag/0.8.17) - 2020-08-19 |
| 40 | |
| 41 | 🐛 **Bug fix** |
| 42 | |
| 43 | - `BigInteger::toBytes()` could return an incorrect binary representation for some numbers |
| 44 | - The bitwise operations `and()`, `or()`, `xor()` on `BigInteger` could return an incorrect result when the GMP extension is not available |
| 45 | |
| 46 | ## [](https://github.com/brick/math/releases/tag/0.8.160.8.16](https://github.com/brick/math/releases/tag/0.8.16](https://github.com/brick/math/releases/tag/0.8.16) - 2020-08-18 |
| 47 | |
| 48 | 🚑 **Critical fix** |
| 49 | |
| 50 | - This version reintroduces the deprecated `BigInteger::parse()` method, that has been removed by mistake in version `0.8.9` and should have lasted for the whole `0.8` release cycle. |
| 51 | |
| 52 | ✨ **New features** |
| 53 | |
| 54 | - `BigInteger::modInverse()` calculates a modular multiplicative inverse |
| 55 | - `BigInteger::fromBytes()` creates a `BigInteger` from a byte string |
| 56 | - `BigInteger::toBytes()` converts a `BigInteger` to a byte string |
| 57 | - `BigInteger::randomBits()` creates a pseudo-random `BigInteger` of a given bit length |
| 58 | - `BigInteger::randomRange()` creates a pseudo-random `BigInteger` between two bounds |
| 59 | |
| 60 | 💩 **Deprecations** |
| 61 | |
| 62 | - `BigInteger::powerMod()` is now deprecated in favour of `modPow()` |
| 63 | |
| 64 | ## [](https://github.com/brick/math/releases/tag/0.8.150.8.15](https://github.com/brick/math/releases/tag/0.8.15](https://github.com/brick/math/releases/tag/0.8.15) - 2020-04-15 |
| 65 | |
| 66 | 🐛 **Fixes** |
| 67 | |
| 68 | - added missing `ext-json` requirement, due to `BigNumber` implementing `JsonSerializable` |
| 69 | |
| 70 | ⚡️ **Optimizations** |
| 71 | |
| 72 | - additional optimization in `BigInteger::remainder()` |
| 73 | |
| 74 | ## [](https://github.com/brick/math/releases/tag/0.8.140.8.14](https://github.com/brick/math/releases/tag/0.8.14](https://github.com/brick/math/releases/tag/0.8.14) - 2020-02-18 |
| 75 | |
| 76 | ✨ **New features** |
| 77 | |
| 78 | - `BigInteger::getLowestSetBit()` returns the index of the rightmost one bit |
| 79 | |
| 80 | ## [](https://github.com/brick/math/releases/tag/0.8.130.8.13](https://github.com/brick/math/releases/tag/0.8.13](https://github.com/brick/math/releases/tag/0.8.13) - 2020-02-16 |
| 81 | |
| 82 | ✨ **New features** |
| 83 | |
| 84 | - `BigInteger::isEven()` tests whether the number is even |
| 85 | - `BigInteger::isOdd()` tests whether the number is odd |
| 86 | - `BigInteger::testBit()` tests if a bit is set |
| 87 | - `BigInteger::getBitLength()` returns the number of bits in the minimal representation of the number |
| 88 | |
| 89 | ## [](https://github.com/brick/math/releases/tag/0.8.120.8.12](https://github.com/brick/math/releases/tag/0.8.12](https://github.com/brick/math/releases/tag/0.8.12) - 2020-02-03 |
| 90 | |
| 91 | 🛠️ **Maintenance release** |
| 92 | |
| 93 | Classes are now annotated for better static analysis with [](https://psalm.dev/psalm](https://psalm.dev/](https://psalm.dev/). |
| 94 | |
| 95 | This is a maintenance release: no bug fixes, no new features, no breaking changes. |
| 96 | |
| 97 | ## [](https://github.com/brick/math/releases/tag/0.8.110.8.11](https://github.com/brick/math/releases/tag/0.8.11](https://github.com/brick/math/releases/tag/0.8.11) - 2020-01-23 |
| 98 | |
| 99 | ✨ **New feature** |
| 100 | |
| 101 | `BigInteger::powerMod()` performs a power-with-modulo operation. Useful for crypto. |
| 102 | |
| 103 | ## [](https://github.com/brick/math/releases/tag/0.8.100.8.10](https://github.com/brick/math/releases/tag/0.8.10](https://github.com/brick/math/releases/tag/0.8.10) - 2020-01-21 |
| 104 | |
| 105 | ✨ **New feature** |
| 106 | |
| 107 | `BigInteger::mod()` returns the **modulo** of two numbers. The *modulo* differs from the *remainder* when the signs of the operands are different. |
| 108 | |
| 109 | ## [](https://github.com/brick/math/releases/tag/0.8.90.8.9](https://github.com/brick/math/releases/tag/0.8.9](https://github.com/brick/math/releases/tag/0.8.9) - 2020-01-08 |
| 110 | |
| 111 | ⚡️ **Performance improvements** |
| 112 | |
| 113 | A few additional optimizations in `BigInteger` and `BigDecimal` when one of the operands can be returned as is. Thanks to @tomtomsen in #24. |
| 114 | |
| 115 | ## [](https://github.com/brick/math/releases/tag/0.8.80.8.8](https://github.com/brick/math/releases/tag/0.8.8](https://github.com/brick/math/releases/tag/0.8.8) - 2019-04-25 |
| 116 | |
| 117 | 🐛 **Bug fixes** |
| 118 | |
| 119 | - `BigInteger::toBase()` could return an empty string for zero values (BCMath & Native calculators only, GMP calculator unaffected) |
| 120 | |
| 121 | ✨ **New features** |
| 122 | |
| 123 | - `BigInteger::toArbitraryBase()` converts a number to an arbitrary base, using a custom alphabet |
| 124 | - `BigInteger::fromArbitraryBase()` converts a string in an arbitrary base, using a custom alphabet, back to a number |
| 125 | |
| 126 | These methods can be used as the foundation to convert strings between different bases/alphabets, using BigInteger as an intermediate representation. |
| 127 | |
| 128 | 💩 **Deprecations** |
| 129 | |
| 130 | - `BigInteger::parse()` is now deprecated in favour of `fromBase()` |
| 131 | |
| 132 | `BigInteger::fromBase()` works the same way as `parse()`, with 2 minor differences: |
| 133 | |
| 134 | - the `$base` parameter is required, it does not default to `10` |
| 135 | - it throws a `NumberFormatException` instead of an `InvalidArgumentException` when the number is malformed |
| 136 | |
| 137 | ## [](https://github.com/brick/math/releases/tag/0.8.70.8.7](https://github.com/brick/math/releases/tag/0.8.7](https://github.com/brick/math/releases/tag/0.8.7) - 2019-04-20 |
| 138 | |
| 139 | **Improvements** |
| 140 | |
| 141 | - Safer conversion from `float` when using custom locales |
| 142 | - **Much faster** `NativeCalculator` implementation 🚀 |
| 143 | |
| 144 | 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. |
| 145 | |
| 146 | ## [](https://github.com/brick/math/releases/tag/0.8.60.8.6](https://github.com/brick/math/releases/tag/0.8.6](https://github.com/brick/math/releases/tag/0.8.6) - 2019-04-11 |
| 147 | |
| 148 | **New method** |
| 149 | |
| 150 | `BigNumber::sum()` returns the sum of one or more numbers. |
| 151 | |
| 152 | ## [](https://github.com/brick/math/releases/tag/0.8.50.8.5](https://github.com/brick/math/releases/tag/0.8.5](https://github.com/brick/math/releases/tag/0.8.5) - 2019-02-12 |
| 153 | |
| 154 | **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). |
| 155 | |
| 156 | Thanks @manowark 👍 |
| 157 | |
| 158 | ## [](https://github.com/brick/math/releases/tag/0.8.40.8.4](https://github.com/brick/math/releases/tag/0.8.4](https://github.com/brick/math/releases/tag/0.8.4) - 2018-12-07 |
| 159 | |
| 160 | **New method** |
| 161 | |
| 162 | `BigDecimal::sqrt()` calculates the square root of a decimal number, to a given scale. |
| 163 | |
| 164 | ## [](https://github.com/brick/math/releases/tag/0.8.30.8.3](https://github.com/brick/math/releases/tag/0.8.3](https://github.com/brick/math/releases/tag/0.8.3) - 2018-12-06 |
| 165 | |
| 166 | **New method** |
| 167 | |
| 168 | `BigInteger::sqrt()` calculates the square root of a number (thanks @peter279k). |
| 169 | |
| 170 | **New exception** |
| 171 | |
| 172 | `NegativeNumberException` is thrown when calling `sqrt()` on a negative number. |
| 173 | |
| 174 | ## [](https://github.com/brick/math/releases/tag/0.8.20.8.2](https://github.com/brick/math/releases/tag/0.8.2](https://github.com/brick/math/releases/tag/0.8.2) - 2018-11-08 |
| 175 | |
| 176 | **Performance update** |
| 177 | |
| 178 | - Further improvement of `toInt()` performance |
| 179 | - `NativeCalculator` can now perform some multiplications more efficiently |
| 180 | |
| 181 | ## [](https://github.com/brick/math/releases/tag/0.8.10.8.1](https://github.com/brick/math/releases/tag/0.8.1](https://github.com/brick/math/releases/tag/0.8.1) - 2018-11-07 |
| 182 | |
| 183 | Performance optimization of `toInt()` methods. |
| 184 | |
| 185 | ## [](https://github.com/brick/math/releases/tag/0.8.00.8.0](https://github.com/brick/math/releases/tag/0.8.0](https://github.com/brick/math/releases/tag/0.8.0) - 2018-10-13 |
| 186 | |
| 187 | **Breaking changes** |
| 188 | |
| 189 | The following deprecated methods have been removed. Use the new method name instead: |
| 190 | |
| 191 | | Method removed | Replacement method | |
| 192 | | --- | --- | |
| 193 | | `BigDecimal::getIntegral()` | `BigDecimal::getIntegralPart()` | |
| 194 | | `BigDecimal::getFraction()` | `BigDecimal::getFractionalPart()` | |
| 195 | |
| 196 | --- |
| 197 | |
| 198 | **New features** |
| 199 | |
| 200 | `BigInteger` has been augmented with 5 new methods for bitwise operations: |
| 201 | |
| 202 | | New method | Description | |
| 203 | | --- | --- | |
| 204 | | `and()` | performs a bitwise `AND` operation on two numbers | |
| 205 | | `or()` | performs a bitwise `OR` operation on two numbers | |
| 206 | | `xor()` | performs a bitwise `XOR` operation on two numbers | |
| 207 | | `shiftedLeft()` | returns the number shifted left by a number of bits | |
| 208 | | `shiftedRight()` | returns the number shifted right by a number of bits | |
| 209 | |
| 210 | Thanks to @DASPRiD 👍 |
| 211 | |
| 212 | ## [](https://github.com/brick/math/releases/tag/0.7.30.7.3](https://github.com/brick/math/releases/tag/0.7.3](https://github.com/brick/math/releases/tag/0.7.3) - 2018-08-20 |
| 213 | |
| 214 | **New method:** `BigDecimal::hasNonZeroFractionalPart()` |
| 215 | |
| 216 | **Renamed/deprecated methods:** |
| 217 | |
| 218 | - `BigDecimal::getIntegral()` has been renamed to `getIntegralPart()` and is now deprecated |
| 219 | - `BigDecimal::getFraction()` has been renamed to `getFractionalPart()` and is now deprecated |
| 220 | |
| 221 | ## [](https://github.com/brick/math/releases/tag/0.7.20.7.2](https://github.com/brick/math/releases/tag/0.7.2](https://github.com/brick/math/releases/tag/0.7.2) - 2018-07-21 |
| 222 | |
| 223 | **Performance update** |
| 224 | |
| 225 | `BigInteger::parse()` and `toBase()` now use GMP's built-in base conversion features when available. |
| 226 | |
| 227 | ## [](https://github.com/brick/math/releases/tag/0.7.10.7.1](https://github.com/brick/math/releases/tag/0.7.1](https://github.com/brick/math/releases/tag/0.7.1) - 2018-03-01 |
| 228 | |
| 229 | This is a maintenance release, no code has been changed. |
| 230 | |
| 231 | - When installed with `--no-dev`, the autoloader does not autoload tests anymore |
| 232 | - Tests and other files unnecessary for production are excluded from the dist package |
| 233 | |
| 234 | This will help make installations more compact. |
| 235 | |
| 236 | ## [](https://github.com/brick/math/releases/tag/0.7.00.7.0](https://github.com/brick/math/releases/tag/0.7.0](https://github.com/brick/math/releases/tag/0.7.0) - 2017-10-02 |
| 237 | |
| 238 | Methods renamed: |
| 239 | |
| 240 | - `BigNumber:sign()` has been renamed to `getSign()` |
| 241 | - `BigDecimal::unscaledValue()` has been renamed to `getUnscaledValue()` |
| 242 | - `BigDecimal::scale()` has been renamed to `getScale()` |
| 243 | - `BigDecimal::integral()` has been renamed to `getIntegral()` |
| 244 | - `BigDecimal::fraction()` has been renamed to `getFraction()` |
| 245 | - `BigRational::numerator()` has been renamed to `getNumerator()` |
| 246 | - `BigRational::denominator()` has been renamed to `getDenominator()` |
| 247 | |
| 248 | Classes renamed: |
| 249 | |
| 250 | - `ArithmeticException` has been renamed to `MathException` |
| 251 | |
| 252 | ## [](https://github.com/brick/math/releases/tag/0.6.20.6.2](https://github.com/brick/math/releases/tag/0.6.2](https://github.com/brick/math/releases/tag/0.6.2) - 2017-10-02 |
| 253 | |
| 254 | The base class for all exceptions is now `MathException`. |
| 255 | `ArithmeticException` has been deprecated, and will be removed in 0.7.0. |
| 256 | |
| 257 | ## [](https://github.com/brick/math/releases/tag/0.6.10.6.1](https://github.com/brick/math/releases/tag/0.6.1](https://github.com/brick/math/releases/tag/0.6.1) - 2017-10-02 |
| 258 | |
| 259 | A number of methods have been renamed: |
| 260 | |
| 261 | - `BigNumber:sign()` is deprecated; use `getSign()` instead |
| 262 | - `BigDecimal::unscaledValue()` is deprecated; use `getUnscaledValue()` instead |
| 263 | - `BigDecimal::scale()` is deprecated; use `getScale()` instead |
| 264 | - `BigDecimal::integral()` is deprecated; use `getIntegral()` instead |
| 265 | - `BigDecimal::fraction()` is deprecated; use `getFraction()` instead |
| 266 | - `BigRational::numerator()` is deprecated; use `getNumerator()` instead |
| 267 | - `BigRational::denominator()` is deprecated; use `getDenominator()` instead |
| 268 | |
| 269 | The old methods will be removed in version 0.7.0. |
| 270 | |
| 271 | ## [](https://github.com/brick/math/releases/tag/0.6.00.6.0](https://github.com/brick/math/releases/tag/0.6.0](https://github.com/brick/math/releases/tag/0.6.0) - 2017-08-25 |
| 272 | |
| 273 | - Minimum PHP version is now [](https://gophp71.org/7.1](https://gophp71.org/](https://gophp71.org/); for PHP 5.6 and PHP 7.0 support, use version `0.5` |
| 274 | - Deprecated method `BigDecimal::withScale()` has been removed; use `toScale()` instead |
| 275 | - Method `BigNumber::toInteger()` has been renamed to `toInt()` |
| 276 | |
| 277 | ## [](https://github.com/brick/math/releases/tag/0.5.40.5.4](https://github.com/brick/math/releases/tag/0.5.4](https://github.com/brick/math/releases/tag/0.5.4) - 2016-10-17 |
| 278 | |
| 279 | `BigNumber` classes now implement [](http://php.net/manual/en/class.jsonserializable.phpJsonSerializable](http://php.net/manual/en/class.jsonserializable.php](http://php.net/manual/en/class.jsonserializable.php). |
| 280 | The JSON output is always a string. |
| 281 | |
| 282 | ## [](https://github.com/brick/math/releases/tag/0.5.30.5.3](https://github.com/brick/math/releases/tag/0.5.3](https://github.com/brick/math/releases/tag/0.5.3) - 2016-03-31 |
| 283 | |
| 284 | 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. |
| 285 | |
| 286 | ## [](https://github.com/brick/math/releases/tag/0.5.20.5.2](https://github.com/brick/math/releases/tag/0.5.2](https://github.com/brick/math/releases/tag/0.5.2) - 2015-08-06 |
| 287 | |
| 288 | The `$scale` parameter of `BigDecimal::dividedBy()` is now optional again. |
| 289 | |
| 290 | ## [](https://github.com/brick/math/releases/tag/0.5.10.5.1](https://github.com/brick/math/releases/tag/0.5.1](https://github.com/brick/math/releases/tag/0.5.1) - 2015-07-05 |
| 291 | |
| 292 | **New method: `BigNumber::toScale()`** |
| 293 | |
| 294 | This allows to convert any `BigNumber` to a `BigDecimal` with a given scale, using rounding if necessary. |
| 295 | |
| 296 | ## [](https://github.com/brick/math/releases/tag/0.5.00.5.0](https://github.com/brick/math/releases/tag/0.5.0](https://github.com/brick/math/releases/tag/0.5.0) - 2015-07-04 |
| 297 | |
| 298 | **New features** |
| 299 | - Common `BigNumber` interface for all classes, with the following methods: |
| 300 | - `sign()` and derived methods (`isZero()`, `isPositive()`, ...) |
| 301 | - `compareTo()` and derived methods (`isEqualTo()`, `isGreaterThan()`, ...) that work across different `BigNumber` types |
| 302 | - `toBigInteger()`, `toBigDecimal()`, `toBigRational`() conversion methods |
| 303 | - `toInteger()` and `toFloat()` conversion methods to native types |
| 304 | - Unified `of()` behaviour: every class now accepts any type of number, provided that it can be safely converted to the current type |
| 305 | - New method: `BigDecimal::exactlyDividedBy()`; this method automatically computes the scale of the result, provided that the division yields a finite number of digits |
| 306 | - New methods: `BigRational::quotient()` and `remainder()` |
| 307 | - Fine-grained exceptions: `DivisionByZeroException`, `RoundingNecessaryException`, `NumberFormatException` |
| 308 | - Factory methods `zero()`, `one()` and `ten()` available in all classes |
| 309 | - Rounding mode reintroduced in `BigInteger::dividedBy()` |
| 310 | |
| 311 | This release also comes with many performance improvements. |
| 312 | |
| 313 | --- |
| 314 | |
| 315 | **Breaking changes** |
| 316 | - `BigInteger`: |
| 317 | - `getSign()` is renamed to `sign()` |
| 318 | - `toString()` is renamed to `toBase()` |
| 319 | - `BigInteger::dividedBy()` now throws an exception by default if the remainder is not zero; use `quotient()` to get the previous behaviour |
| 320 | - `BigDecimal`: |
| 321 | - `getSign()` is renamed to `sign()` |
| 322 | - `getUnscaledValue()` is renamed to `unscaledValue()` |
| 323 | - `getScale()` is renamed to `scale()` |
| 324 | - `getIntegral()` is renamed to `integral()` |
| 325 | - `getFraction()` is renamed to `fraction()` |
| 326 | - `divideAndRemainder()` is renamed to `quotientAndRemainder()` |
| 327 | - `dividedBy()` now takes a **mandatory** `$scale` parameter **before** the rounding mode |
| 328 | - `toBigInteger()` does not accept a `$roundingMode` parameter any more |
| 329 | - `toBigRational()` does not simplify the fraction any more; explicitly add `->simplified()` to get the previous behaviour |
| 330 | - `BigRational`: |
| 331 | - `getSign()` is renamed to `sign()` |
| 332 | - `getNumerator()` is renamed to `numerator()` |
| 333 | - `getDenominator()` is renamed to `denominator()` |
| 334 | - `of()` is renamed to `nd()`, while `parse()` is renamed to `of()` |
| 335 | - Miscellaneous: |
| 336 | - `ArithmeticException` is moved to an `Exception\` sub-namespace |
| 337 | - `of()` factory methods now throw `NumberFormatException` instead of `InvalidArgumentException` |
| 338 | |
| 339 | ## [](https://github.com/brick/math/releases/tag/0.4.30.4.3](https://github.com/brick/math/releases/tag/0.4.3](https://github.com/brick/math/releases/tag/0.4.3) - 2016-03-31 |
| 340 | |
| 341 | Backport of two bug fixes from the 0.5 branch: |
| 342 | - `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected |
| 343 | - 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. |
| 344 | |
| 345 | ## [](https://github.com/brick/math/releases/tag/0.4.20.4.2](https://github.com/brick/math/releases/tag/0.4.2](https://github.com/brick/math/releases/tag/0.4.2) - 2015-06-16 |
| 346 | |
| 347 | New method: `BigDecimal::stripTrailingZeros()` |
| 348 | |
| 349 | ## [](https://github.com/brick/math/releases/tag/0.4.10.4.1](https://github.com/brick/math/releases/tag/0.4.1](https://github.com/brick/math/releases/tag/0.4.1) - 2015-06-12 |
| 350 | |
| 351 | Introducing a `BigRational` class, to perform calculations on fractions of any size. |
| 352 | |
| 353 | ## [](https://github.com/brick/math/releases/tag/0.4.00.4.0](https://github.com/brick/math/releases/tag/0.4.0](https://github.com/brick/math/releases/tag/0.4.0) - 2015-06-12 |
| 354 | |
| 355 | Rounding modes have been removed from `BigInteger`, and are now a concept specific to `BigDecimal`. |
| 356 | |
| 357 | `BigInteger::dividedBy()` now always returns the quotient of the division. |
| 358 | |
| 359 | ## [](https://github.com/brick/math/releases/tag/0.3.50.3.5](https://github.com/brick/math/releases/tag/0.3.5](https://github.com/brick/math/releases/tag/0.3.5) - 2016-03-31 |
| 360 | |
| 361 | Backport of two bug fixes from the 0.5 branch: |
| 362 | |
| 363 | - `BigInteger::parse()` did not always throw `InvalidArgumentException` as expected |
| 364 | - 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. |
| 365 | |
| 366 | ## [](https://github.com/brick/math/releases/tag/0.3.40.3.4](https://github.com/brick/math/releases/tag/0.3.4](https://github.com/brick/math/releases/tag/0.3.4) - 2015-06-11 |
| 367 | |
| 368 | New methods: |
| 369 | - `BigInteger::remainder()` returns the remainder of a division only |
| 370 | - `BigInteger::gcd()` returns the greatest common divisor of two numbers |
| 371 | |
| 372 | ## [](https://github.com/brick/math/releases/tag/0.3.30.3.3](https://github.com/brick/math/releases/tag/0.3.3](https://github.com/brick/math/releases/tag/0.3.3) - 2015-06-07 |
| 373 | |
| 374 | Fix `toString()` not handling negative numbers. |
| 375 | |
| 376 | ## [](https://github.com/brick/math/releases/tag/0.3.20.3.2](https://github.com/brick/math/releases/tag/0.3.2](https://github.com/brick/math/releases/tag/0.3.2) - 2015-06-07 |
| 377 | |
| 378 | `BigInteger` and `BigDecimal` now have a `getSign()` method that returns: |
| 379 | - `-1` if the number is negative |
| 380 | - `0` if the number is zero |
| 381 | - `1` if the number is positive |
| 382 | |
| 383 | ## [](https://github.com/brick/math/releases/tag/0.3.10.3.1](https://github.com/brick/math/releases/tag/0.3.1](https://github.com/brick/math/releases/tag/0.3.1) - 2015-06-05 |
| 384 | |
| 385 | Minor performance improvements |
| 386 | |
| 387 | ## [](https://github.com/brick/math/releases/tag/0.3.00.3.0](https://github.com/brick/math/releases/tag/0.3.0](https://github.com/brick/math/releases/tag/0.3.0) - 2015-06-04 |
| 388 | |
| 389 | The `$roundingMode` and `$scale` parameters have been swapped in `BigDecimal::dividedBy()`. |
| 390 | |
| 391 | ## [](https://github.com/brick/math/releases/tag/0.2.20.2.2](https://github.com/brick/math/releases/tag/0.2.2](https://github.com/brick/math/releases/tag/0.2.2) - 2015-06-04 |
| 392 | |
| 393 | Stronger immutability guarantee for `BigInteger` and `BigDecimal`. |
| 394 | |
| 395 | So far, it would have been possible to break immutability of these classes by calling the `unserialize()` internal function. This release fixes that. |
| 396 | |
| 397 | ## [](https://github.com/brick/math/releases/tag/0.2.10.2.1](https://github.com/brick/math/releases/tag/0.2.1](https://github.com/brick/math/releases/tag/0.2.1) - 2015-06-02 |
| 398 | |
| 399 | Added `BigDecimal::divideAndRemainder()` |
| 400 | |
| 401 | ## [](https://github.com/brick/math/releases/tag/0.2.00.2.0](https://github.com/brick/math/releases/tag/0.2.0](https://github.com/brick/math/releases/tag/0.2.0) - 2015-05-22 |
| 402 | |
| 403 | - `min()` and `max()` do not accept an `array` any more, but a variable number of parameters |
| 404 | - **minimum PHP version is now 5.6** |
| 405 | - continuous integration with PHP 7 |
| 406 | |
| 407 | ## [](https://github.com/brick/math/releases/tag/0.1.10.1.1](https://github.com/brick/math/releases/tag/0.1.1](https://github.com/brick/math/releases/tag/0.1.1) - 2014-09-01 |
| 408 | |
| 409 | - Added `BigInteger::power()` |
| 410 | - Added HHVM support |
| 411 | |
| 412 | ## [](https://github.com/brick/math/releases/tag/0.1.00.1.0](https://github.com/brick/math/releases/tag/0.1.0](https://github.com/brick/math/releases/tag/0.1.0) - 2014-08-31 |
| 413 | |
| 414 | First beta release. |
| 415 | |
| 416 |