1--TEST--
2BcMath\Number add object by operator
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 $value1) {
16    $num1 = new BcMath\Number($value1);
17
18    foreach ($values as $value2) {
19        echo "{$value1} + {$value2}\n";
20        $num2 = new BcMath\Number($value2);
21        $ret = $num1 + $num2;
22        var_dump($ret);
23        echo "\n";
24    }
25}
26?>
27--EXPECT--
28100 + 100
29object(BcMath\Number)#3 (2) {
30  ["value"]=>
31  string(3) "200"
32  ["scale"]=>
33  int(0)
34}
35
36100 + -20
37object(BcMath\Number)#2 (2) {
38  ["value"]=>
39  string(2) "80"
40  ["scale"]=>
41  int(0)
42}
43
44100 + 0.01
45object(BcMath\Number)#4 (2) {
46  ["value"]=>
47  string(6) "100.01"
48  ["scale"]=>
49  int(2)
50}
51
52100 + -0.40
53object(BcMath\Number)#3 (2) {
54  ["value"]=>
55  string(5) "99.60"
56  ["scale"]=>
57  int(2)
58}
59
60-20 + 100
61object(BcMath\Number)#2 (2) {
62  ["value"]=>
63  string(2) "80"
64  ["scale"]=>
65  int(0)
66}
67
68-20 + -20
69object(BcMath\Number)#1 (2) {
70  ["value"]=>
71  string(3) "-40"
72  ["scale"]=>
73  int(0)
74}
75
76-20 + 0.01
77object(BcMath\Number)#3 (2) {
78  ["value"]=>
79  string(6) "-19.99"
80  ["scale"]=>
81  int(2)
82}
83
84-20 + -0.40
85object(BcMath\Number)#2 (2) {
86  ["value"]=>
87  string(6) "-20.40"
88  ["scale"]=>
89  int(2)
90}
91
920.01 + 100
93object(BcMath\Number)#1 (2) {
94  ["value"]=>
95  string(6) "100.01"
96  ["scale"]=>
97  int(2)
98}
99
1000.01 + -20
101object(BcMath\Number)#4 (2) {
102  ["value"]=>
103  string(6) "-19.99"
104  ["scale"]=>
105  int(2)
106}
107
1080.01 + 0.01
109object(BcMath\Number)#2 (2) {
110  ["value"]=>
111  string(4) "0.02"
112  ["scale"]=>
113  int(2)
114}
115
1160.01 + -0.40
117object(BcMath\Number)#1 (2) {
118  ["value"]=>
119  string(5) "-0.39"
120  ["scale"]=>
121  int(2)
122}
123
124-0.40 + 100
125object(BcMath\Number)#4 (2) {
126  ["value"]=>
127  string(5) "99.60"
128  ["scale"]=>
129  int(2)
130}
131
132-0.40 + -20
133object(BcMath\Number)#3 (2) {
134  ["value"]=>
135  string(6) "-20.40"
136  ["scale"]=>
137  int(2)
138}
139
140-0.40 + 0.01
141object(BcMath\Number)#1 (2) {
142  ["value"]=>
143  string(5) "-0.39"
144  ["scale"]=>
145  int(2)
146}
147
148-0.40 + -0.40
149object(BcMath\Number)#4 (2) {
150  ["value"]=>
151  string(5) "-0.80"
152  ["scale"]=>
153  int(2)
154}
155