xref: /PHP-8.3/ext/bcmath/tests/bcdiv_zero.phpt (revision ee226128)
1--TEST--
2bcdiv() function with number zero
3--EXTENSIONS--
4bcmath
5--INI--
6bcmath.scale=0
7--FILE--
8<?php
9require(__DIR__ . "/run_bcmath_tests_function.inc");
10
11$dividends = ["0", "0.00", "-0", "-0.00"];
12$divisors = [
13    "15",
14    "-15",
15    "1",
16    "-9",
17    "14.14",
18    "-16.60",
19    "0.15",
20    "-0.01",
21    "15151324141414.412312232141241",
22    "-132132245132134.1515123765412",
23    "141241241241241248267654747412",
24    "-149143276547656984948124912",
25    "0.1322135476547459213732911312",
26    "-0.123912932193769965476541321",
27];
28
29run_bcmath_tests($dividends, $divisors, "/", bcdiv(...));
30
31?>
32--EXPECT--
33Number "0" (scale 0)
340 / 15                             = 0
350 / -15                            = 0
360 / 1                              = 0
370 / -9                             = 0
380 / 14.14                          = 0
390 / -16.60                         = 0
400 / 0.15                           = 0
410 / -0.01                          = 0
420 / 15151324141414.412312232141241 = 0
430 / -132132245132134.1515123765412 = 0
440 / 141241241241241248267654747412 = 0
450 / -149143276547656984948124912   = 0
460 / 0.1322135476547459213732911312 = 0
470 / -0.123912932193769965476541321 = 0
48
49Number "0.00" (scale 0)
500.00 / 15                             = 0
510.00 / -15                            = 0
520.00 / 1                              = 0
530.00 / -9                             = 0
540.00 / 14.14                          = 0
550.00 / -16.60                         = 0
560.00 / 0.15                           = 0
570.00 / -0.01                          = 0
580.00 / 15151324141414.412312232141241 = 0
590.00 / -132132245132134.1515123765412 = 0
600.00 / 141241241241241248267654747412 = 0
610.00 / -149143276547656984948124912   = 0
620.00 / 0.1322135476547459213732911312 = 0
630.00 / -0.123912932193769965476541321 = 0
64
65Number "-0" (scale 0)
66-0 / 15                             = 0
67-0 / -15                            = 0
68-0 / 1                              = 0
69-0 / -9                             = 0
70-0 / 14.14                          = 0
71-0 / -16.60                         = 0
72-0 / 0.15                           = 0
73-0 / -0.01                          = 0
74-0 / 15151324141414.412312232141241 = 0
75-0 / -132132245132134.1515123765412 = 0
76-0 / 141241241241241248267654747412 = 0
77-0 / -149143276547656984948124912   = 0
78-0 / 0.1322135476547459213732911312 = 0
79-0 / -0.123912932193769965476541321 = 0
80
81Number "-0.00" (scale 0)
82-0.00 / 15                             = 0
83-0.00 / -15                            = 0
84-0.00 / 1                              = 0
85-0.00 / -9                             = 0
86-0.00 / 14.14                          = 0
87-0.00 / -16.60                         = 0
88-0.00 / 0.15                           = 0
89-0.00 / -0.01                          = 0
90-0.00 / 15151324141414.412312232141241 = 0
91-0.00 / -132132245132134.1515123765412 = 0
92-0.00 / 141241241241241248267654747412 = 0
93-0.00 / -149143276547656984948124912   = 0
94-0.00 / 0.1322135476547459213732911312 = 0
95-0.00 / -0.123912932193769965476541321 = 0
96
97Number "0" (scale 10)
980 / 15                             = 0.0000000000
990 / -15                            = 0.0000000000
1000 / 1                              = 0.0000000000
1010 / -9                             = 0.0000000000
1020 / 14.14                          = 0.0000000000
1030 / -16.60                         = 0.0000000000
1040 / 0.15                           = 0.0000000000
1050 / -0.01                          = 0.0000000000
1060 / 15151324141414.412312232141241 = 0.0000000000
1070 / -132132245132134.1515123765412 = 0.0000000000
1080 / 141241241241241248267654747412 = 0.0000000000
1090 / -149143276547656984948124912   = 0.0000000000
1100 / 0.1322135476547459213732911312 = 0.0000000000
1110 / -0.123912932193769965476541321 = 0.0000000000
112
113Number "0.00" (scale 10)
1140.00 / 15                             = 0.0000000000
1150.00 / -15                            = 0.0000000000
1160.00 / 1                              = 0.0000000000
1170.00 / -9                             = 0.0000000000
1180.00 / 14.14                          = 0.0000000000
1190.00 / -16.60                         = 0.0000000000
1200.00 / 0.15                           = 0.0000000000
1210.00 / -0.01                          = 0.0000000000
1220.00 / 15151324141414.412312232141241 = 0.0000000000
1230.00 / -132132245132134.1515123765412 = 0.0000000000
1240.00 / 141241241241241248267654747412 = 0.0000000000
1250.00 / -149143276547656984948124912   = 0.0000000000
1260.00 / 0.1322135476547459213732911312 = 0.0000000000
1270.00 / -0.123912932193769965476541321 = 0.0000000000
128
129Number "-0" (scale 10)
130-0 / 15                             = 0.0000000000
131-0 / -15                            = 0.0000000000
132-0 / 1                              = 0.0000000000
133-0 / -9                             = 0.0000000000
134-0 / 14.14                          = 0.0000000000
135-0 / -16.60                         = 0.0000000000
136-0 / 0.15                           = 0.0000000000
137-0 / -0.01                          = 0.0000000000
138-0 / 15151324141414.412312232141241 = 0.0000000000
139-0 / -132132245132134.1515123765412 = 0.0000000000
140-0 / 141241241241241248267654747412 = 0.0000000000
141-0 / -149143276547656984948124912   = 0.0000000000
142-0 / 0.1322135476547459213732911312 = 0.0000000000
143-0 / -0.123912932193769965476541321 = 0.0000000000
144
145Number "-0.00" (scale 10)
146-0.00 / 15                             = 0.0000000000
147-0.00 / -15                            = 0.0000000000
148-0.00 / 1                              = 0.0000000000
149-0.00 / -9                             = 0.0000000000
150-0.00 / 14.14                          = 0.0000000000
151-0.00 / -16.60                         = 0.0000000000
152-0.00 / 0.15                           = 0.0000000000
153-0.00 / -0.01                          = 0.0000000000
154-0.00 / 15151324141414.412312232141241 = 0.0000000000
155-0.00 / -132132245132134.1515123765412 = 0.0000000000
156-0.00 / 141241241241241248267654747412 = 0.0000000000
157-0.00 / -149143276547656984948124912   = 0.0000000000
158-0.00 / 0.1322135476547459213732911312 = 0.0000000000
159-0.00 / -0.123912932193769965476541321 = 0.0000000000
160