xref: /php-src/ext/bcmath/tests/bcpow_zero.phpt (revision 549c6578)
1--TEST--
2bcpow() 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$exponents = ["0", "-0", "1", "1128321638"];
12$baseNumbers = [
13    "0.00",
14    "-0.00",
15    "0.000000000000000000000000",
16    "-0.000000000000000000000000",
17    "-0",
18    "0",
19];
20
21run_bcmath_tests($baseNumbers, $exponents, "**", bcpow(...));
22
23?>
24--EXPECT--
25Number "0.00" (scale 0)
260.00 ** 0                              = 1
270.00 ** -0                             = 1
280.00 ** 1                              = 0
290.00 ** 1128321638                     = 0
30
31Number "-0.00" (scale 0)
32-0.00 ** 0                              = 1
33-0.00 ** -0                             = 1
34-0.00 ** 1                              = 0
35-0.00 ** 1128321638                     = 0
36
37Number "0.000000000000000000000000" (scale 0)
380.000000000000000000000000 ** 0                              = 1
390.000000000000000000000000 ** -0                             = 1
400.000000000000000000000000 ** 1                              = 0
410.000000000000000000000000 ** 1128321638                     = 0
42
43Number "-0.000000000000000000000000" (scale 0)
44-0.000000000000000000000000 ** 0                              = 1
45-0.000000000000000000000000 ** -0                             = 1
46-0.000000000000000000000000 ** 1                              = 0
47-0.000000000000000000000000 ** 1128321638                     = 0
48
49Number "-0" (scale 0)
50-0 ** 0                              = 1
51-0 ** -0                             = 1
52-0 ** 1                              = 0
53-0 ** 1128321638                     = 0
54
55Number "0" (scale 0)
560 ** 0                              = 1
570 ** -0                             = 1
580 ** 1                              = 0
590 ** 1128321638                     = 0
60
61Number "0.00" (scale 10)
620.00 ** 0                              = 1.0000000000
630.00 ** -0                             = 1.0000000000
640.00 ** 1                              = 0.0000000000
650.00 ** 1128321638                     = 0.0000000000
66
67Number "-0.00" (scale 10)
68-0.00 ** 0                              = 1.0000000000
69-0.00 ** -0                             = 1.0000000000
70-0.00 ** 1                              = 0.0000000000
71-0.00 ** 1128321638                     = 0.0000000000
72
73Number "0.000000000000000000000000" (scale 10)
740.000000000000000000000000 ** 0                              = 1.0000000000
750.000000000000000000000000 ** -0                             = 1.0000000000
760.000000000000000000000000 ** 1                              = 0.0000000000
770.000000000000000000000000 ** 1128321638                     = 0.0000000000
78
79Number "-0.000000000000000000000000" (scale 10)
80-0.000000000000000000000000 ** 0                              = 1.0000000000
81-0.000000000000000000000000 ** -0                             = 1.0000000000
82-0.000000000000000000000000 ** 1                              = 0.0000000000
83-0.000000000000000000000000 ** 1128321638                     = 0.0000000000
84
85Number "-0" (scale 10)
86-0 ** 0                              = 1.0000000000
87-0 ** -0                             = 1.0000000000
88-0 ** 1                              = 0.0000000000
89-0 ** 1128321638                     = 0.0000000000
90
91Number "0" (scale 10)
920 ** 0                              = 1.0000000000
930 ** -0                             = 1.0000000000
940 ** 1                              = 0.0000000000
950 ** 1128321638                     = 0.0000000000
96