Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

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