1--TEST--
2BcMath\Number decrement
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7
8$values = [
9    100,
10    '-20',
11    '0.01',
12    '-0.40',
13];
14
15foreach ($values as $value) {
16    echo "========== {$value}-- ==========\n";
17    $num = new BcMath\Number($value);
18    $num_old = $num;
19
20    $num--;
21    echo '$num:' . "\n";
22    var_dump($num);
23
24    echo '$num_old:' . "\n";
25    var_dump($num_old);
26
27    echo "\n";
28}
29?>
30--EXPECT--
31========== 100-- ==========
32$num:
33object(BcMath\Number)#2 (2) {
34  ["value"]=>
35  string(2) "99"
36  ["scale"]=>
37  int(0)
38}
39$num_old:
40object(BcMath\Number)#1 (2) {
41  ["value"]=>
42  string(3) "100"
43  ["scale"]=>
44  int(0)
45}
46
47========== -20-- ==========
48$num:
49object(BcMath\Number)#1 (2) {
50  ["value"]=>
51  string(3) "-21"
52  ["scale"]=>
53  int(0)
54}
55$num_old:
56object(BcMath\Number)#3 (2) {
57  ["value"]=>
58  string(3) "-20"
59  ["scale"]=>
60  int(0)
61}
62
63========== 0.01-- ==========
64$num:
65object(BcMath\Number)#3 (2) {
66  ["value"]=>
67  string(5) "-0.99"
68  ["scale"]=>
69  int(2)
70}
71$num_old:
72object(BcMath\Number)#2 (2) {
73  ["value"]=>
74  string(4) "0.01"
75  ["scale"]=>
76  int(2)
77}
78
79========== -0.40-- ==========
80$num:
81object(BcMath\Number)#2 (2) {
82  ["value"]=>
83  string(5) "-1.40"
84  ["scale"]=>
85  int(2)
86}
87$num_old:
88object(BcMath\Number)#1 (2) {
89  ["value"]=>
90  string(5) "-0.40"
91  ["scale"]=>
92  int(2)
93}
94