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