1--TEST--
2BcMath\Number mul string 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        $ret = $num1 * ((string) $value2);
21        $ret2 = ((string) $value1) * (new BcMath\Number($value2));
22        if ($ret->compare($ret2) !== 0) {
23            echo "Result is incorrect.\n";
24        }
25        var_dump($ret);
26        echo "\n";
27    }
28}
29?>
30--EXPECT--
31100 * 100
32object(BcMath\Number)#2 (2) {
33  ["value"]=>
34  string(5) "10000"
35  ["scale"]=>
36  int(0)
37}
38
39100 * -20
40object(BcMath\Number)#3 (2) {
41  ["value"]=>
42  string(5) "-2000"
43  ["scale"]=>
44  int(0)
45}
46
47100 * 0.01
48object(BcMath\Number)#4 (2) {
49  ["value"]=>
50  string(4) "1.00"
51  ["scale"]=>
52  int(2)
53}
54
55100 * -0.40
56object(BcMath\Number)#5 (2) {
57  ["value"]=>
58  string(6) "-40.00"
59  ["scale"]=>
60  int(2)
61}
62
63-20 * 100
64object(BcMath\Number)#1 (2) {
65  ["value"]=>
66  string(5) "-2000"
67  ["scale"]=>
68  int(0)
69}
70
71-20 * -20
72object(BcMath\Number)#3 (2) {
73  ["value"]=>
74  string(3) "400"
75  ["scale"]=>
76  int(0)
77}
78
79-20 * 0.01
80object(BcMath\Number)#4 (2) {
81  ["value"]=>
82  string(5) "-0.20"
83  ["scale"]=>
84  int(2)
85}
86
87-20 * -0.40
88object(BcMath\Number)#5 (2) {
89  ["value"]=>
90  string(4) "8.00"
91  ["scale"]=>
92  int(2)
93}
94
950.01 * 100
96object(BcMath\Number)#2 (2) {
97  ["value"]=>
98  string(4) "1.00"
99  ["scale"]=>
100  int(2)
101}
102
1030.01 * -20
104object(BcMath\Number)#3 (2) {
105  ["value"]=>
106  string(5) "-0.20"
107  ["scale"]=>
108  int(2)
109}
110
1110.01 * 0.01
112object(BcMath\Number)#4 (2) {
113  ["value"]=>
114  string(6) "0.0001"
115  ["scale"]=>
116  int(4)
117}
118
1190.01 * -0.40
120object(BcMath\Number)#5 (2) {
121  ["value"]=>
122  string(7) "-0.0040"
123  ["scale"]=>
124  int(4)
125}
126
127-0.40 * 100
128object(BcMath\Number)#1 (2) {
129  ["value"]=>
130  string(6) "-40.00"
131  ["scale"]=>
132  int(2)
133}
134
135-0.40 * -20
136object(BcMath\Number)#3 (2) {
137  ["value"]=>
138  string(4) "8.00"
139  ["scale"]=>
140  int(2)
141}
142
143-0.40 * 0.01
144object(BcMath\Number)#4 (2) {
145  ["value"]=>
146  string(7) "-0.0040"
147  ["scale"]=>
148  int(4)
149}
150
151-0.40 * -0.40
152object(BcMath\Number)#5 (2) {
153  ["value"]=>
154  string(6) "0.1600"
155  ["scale"]=>
156  int(4)
157}
158