1--TEST--
2BcMath\Number div int by operator
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7
8$values = [
9    100,
10    '-20',
11    3,
12];
13
14foreach ($values as $value1) {
15    $num1 = new BcMath\Number($value1);
16
17    foreach ($values as $value2) {
18        echo "{$value1} / {$value2}\n";
19        $ret = $num1 / ((int) $value2);
20        $ret2 = ((int) $value1) / (new BcMath\Number($value2));
21        if ($ret->compare($ret2) !== 0) {
22            echo "Result is incorrect.\n";
23        }
24        var_dump($ret);
25        echo "\n";
26    }
27}
28?>
29--EXPECT--
30100 / 100
31object(BcMath\Number)#2 (2) {
32  ["value"]=>
33  string(1) "1"
34  ["scale"]=>
35  int(0)
36}
37
38100 / -20
39object(BcMath\Number)#3 (2) {
40  ["value"]=>
41  string(2) "-5"
42  ["scale"]=>
43  int(0)
44}
45
46100 / 3
47object(BcMath\Number)#4 (2) {
48  ["value"]=>
49  string(13) "33.3333333333"
50  ["scale"]=>
51  int(10)
52}
53
54-20 / 100
55object(BcMath\Number)#1 (2) {
56  ["value"]=>
57  string(4) "-0.2"
58  ["scale"]=>
59  int(1)
60}
61
62-20 / -20
63object(BcMath\Number)#2 (2) {
64  ["value"]=>
65  string(1) "1"
66  ["scale"]=>
67  int(0)
68}
69
70-20 / 3
71object(BcMath\Number)#3 (2) {
72  ["value"]=>
73  string(13) "-6.6666666666"
74  ["scale"]=>
75  int(10)
76}
77
783 / 100
79object(BcMath\Number)#5 (2) {
80  ["value"]=>
81  string(4) "0.03"
82  ["scale"]=>
83  int(2)
84}
85
863 / -20
87object(BcMath\Number)#1 (2) {
88  ["value"]=>
89  string(5) "-0.15"
90  ["scale"]=>
91  int(2)
92}
93
943 / 3
95object(BcMath\Number)#2 (2) {
96  ["value"]=>
97  string(1) "1"
98  ["scale"]=>
99  int(0)
100}
101