xref: /PHP-8.3/ext/bcmath/tests/bcsub_zero.phpt (revision ee226128)
1--TEST--
2bcsub() 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$minuends = ["0", "0.00", "-0", "-0.00"];
12$subtrahends = array_merge($minuends, [
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($minuends, $subtrahends, "-", bcsub(...));
30
31?>
32--EXPECT--
33Number "0" (scale 0)
340 - 0                              = 0
350 - 0.00                           = 0
360 - -0                             = 0
370 - -0.00                          = 0
380 - 15                             = -15
390 - -15                            = 15
400 - 1                              = -1
410 - -9                             = 9
420 - 14.14                          = -14
430 - -16.60                         = 16
440 - 0.15                           = 0
450 - -0.01                          = 0
460 - 15151324141414.412312232141241 = -15151324141414
470 - -132132245132134.1515123765412 = 132132245132134
480 - 141241241241241248267654747412 = -141241241241241248267654747412
490 - -149143276547656984948124912   = 149143276547656984948124912
500 - 0.1322135476547459213732911312 = 0
510 - -0.123912932193769965476541321 = 0
52
53Number "0.00" (scale 0)
540.00 - 0                              = 0
550.00 - 0.00                           = 0
560.00 - -0                             = 0
570.00 - -0.00                          = 0
580.00 - 15                             = -15
590.00 - -15                            = 15
600.00 - 1                              = -1
610.00 - -9                             = 9
620.00 - 14.14                          = -14
630.00 - -16.60                         = 16
640.00 - 0.15                           = 0
650.00 - -0.01                          = 0
660.00 - 15151324141414.412312232141241 = -15151324141414
670.00 - -132132245132134.1515123765412 = 132132245132134
680.00 - 141241241241241248267654747412 = -141241241241241248267654747412
690.00 - -149143276547656984948124912   = 149143276547656984948124912
700.00 - 0.1322135476547459213732911312 = 0
710.00 - -0.123912932193769965476541321 = 0
72
73Number "-0" (scale 0)
74-0 - 0                              = 0
75-0 - 0.00                           = 0
76-0 - -0                             = 0
77-0 - -0.00                          = 0
78-0 - 15                             = -15
79-0 - -15                            = 15
80-0 - 1                              = -1
81-0 - -9                             = 9
82-0 - 14.14                          = -14
83-0 - -16.60                         = 16
84-0 - 0.15                           = 0
85-0 - -0.01                          = 0
86-0 - 15151324141414.412312232141241 = -15151324141414
87-0 - -132132245132134.1515123765412 = 132132245132134
88-0 - 141241241241241248267654747412 = -141241241241241248267654747412
89-0 - -149143276547656984948124912   = 149143276547656984948124912
90-0 - 0.1322135476547459213732911312 = 0
91-0 - -0.123912932193769965476541321 = 0
92
93Number "-0.00" (scale 0)
94-0.00 - 0                              = 0
95-0.00 - 0.00                           = 0
96-0.00 - -0                             = 0
97-0.00 - -0.00                          = 0
98-0.00 - 15                             = -15
99-0.00 - -15                            = 15
100-0.00 - 1                              = -1
101-0.00 - -9                             = 9
102-0.00 - 14.14                          = -14
103-0.00 - -16.60                         = 16
104-0.00 - 0.15                           = 0
105-0.00 - -0.01                          = 0
106-0.00 - 15151324141414.412312232141241 = -15151324141414
107-0.00 - -132132245132134.1515123765412 = 132132245132134
108-0.00 - 141241241241241248267654747412 = -141241241241241248267654747412
109-0.00 - -149143276547656984948124912   = 149143276547656984948124912
110-0.00 - 0.1322135476547459213732911312 = 0
111-0.00 - -0.123912932193769965476541321 = 0
112
113Number "0" (scale 10)
1140 - 0                              = 0.0000000000
1150 - 0.00                           = 0.0000000000
1160 - -0                             = 0.0000000000
1170 - -0.00                          = 0.0000000000
1180 - 15                             = -15.0000000000
1190 - -15                            = 15.0000000000
1200 - 1                              = -1.0000000000
1210 - -9                             = 9.0000000000
1220 - 14.14                          = -14.1400000000
1230 - -16.60                         = 16.6000000000
1240 - 0.15                           = -0.1500000000
1250 - -0.01                          = 0.0100000000
1260 - 15151324141414.412312232141241 = -15151324141414.4123122321
1270 - -132132245132134.1515123765412 = 132132245132134.1515123765
1280 - 141241241241241248267654747412 = -141241241241241248267654747412.0000000000
1290 - -149143276547656984948124912   = 149143276547656984948124912.0000000000
1300 - 0.1322135476547459213732911312 = -0.1322135476
1310 - -0.123912932193769965476541321 = 0.1239129321
132
133Number "0.00" (scale 10)
1340.00 - 0                              = 0.0000000000
1350.00 - 0.00                           = 0.0000000000
1360.00 - -0                             = 0.0000000000
1370.00 - -0.00                          = 0.0000000000
1380.00 - 15                             = -15.0000000000
1390.00 - -15                            = 15.0000000000
1400.00 - 1                              = -1.0000000000
1410.00 - -9                             = 9.0000000000
1420.00 - 14.14                          = -14.1400000000
1430.00 - -16.60                         = 16.6000000000
1440.00 - 0.15                           = -0.1500000000
1450.00 - -0.01                          = 0.0100000000
1460.00 - 15151324141414.412312232141241 = -15151324141414.4123122321
1470.00 - -132132245132134.1515123765412 = 132132245132134.1515123765
1480.00 - 141241241241241248267654747412 = -141241241241241248267654747412.0000000000
1490.00 - -149143276547656984948124912   = 149143276547656984948124912.0000000000
1500.00 - 0.1322135476547459213732911312 = -0.1322135476
1510.00 - -0.123912932193769965476541321 = 0.1239129321
152
153Number "-0" (scale 10)
154-0 - 0                              = 0.0000000000
155-0 - 0.00                           = 0.0000000000
156-0 - -0                             = 0.0000000000
157-0 - -0.00                          = 0.0000000000
158-0 - 15                             = -15.0000000000
159-0 - -15                            = 15.0000000000
160-0 - 1                              = -1.0000000000
161-0 - -9                             = 9.0000000000
162-0 - 14.14                          = -14.1400000000
163-0 - -16.60                         = 16.6000000000
164-0 - 0.15                           = -0.1500000000
165-0 - -0.01                          = 0.0100000000
166-0 - 15151324141414.412312232141241 = -15151324141414.4123122321
167-0 - -132132245132134.1515123765412 = 132132245132134.1515123765
168-0 - 141241241241241248267654747412 = -141241241241241248267654747412.0000000000
169-0 - -149143276547656984948124912   = 149143276547656984948124912.0000000000
170-0 - 0.1322135476547459213732911312 = -0.1322135476
171-0 - -0.123912932193769965476541321 = 0.1239129321
172
173Number "-0.00" (scale 10)
174-0.00 - 0                              = 0.0000000000
175-0.00 - 0.00                           = 0.0000000000
176-0.00 - -0                             = 0.0000000000
177-0.00 - -0.00                          = 0.0000000000
178-0.00 - 15                             = -15.0000000000
179-0.00 - -15                            = 15.0000000000
180-0.00 - 1                              = -1.0000000000
181-0.00 - -9                             = 9.0000000000
182-0.00 - 14.14                          = -14.1400000000
183-0.00 - -16.60                         = 16.6000000000
184-0.00 - 0.15                           = -0.1500000000
185-0.00 - -0.01                          = 0.0100000000
186-0.00 - 15151324141414.412312232141241 = -15151324141414.4123122321
187-0.00 - -132132245132134.1515123765412 = 132132245132134.1515123765
188-0.00 - 141241241241241248267654747412 = -141241241241241248267654747412.0000000000
189-0.00 - -149143276547656984948124912   = 149143276547656984948124912.0000000000
190-0.00 - 0.1322135476547459213732911312 = -0.1322135476
191-0.00 - -0.123912932193769965476541321 = 0.1239129321
192