xref: /PHP-7.4/ext/gmp/tests/gmp_remroot.phpt (revision 782352c5)
1--TEST--
2gmp_rootrem() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_rootrem());
9
10var_dump(gmp_rootrem(1000, 3));
11var_dump(gmp_rootrem(100, 3));
12var_dump(gmp_rootrem(-100, 3));
13
14var_dump(gmp_rootrem(1000, 4));
15var_dump(gmp_rootrem(100, 4));
16var_dump(gmp_rootrem(-100, 4));
17
18var_dump(gmp_rootrem(0, 3));
19var_dump(gmp_rootrem(100, 0));
20var_dump(gmp_rootrem(100, -3));
21
22?>
23--EXPECTF--
24Warning: gmp_rootrem() expects exactly 2 parameters, 0 given in %s on line %d
25NULL
26array(2) {
27  [0]=>
28  object(GMP)#%d (1) {
29    ["num"]=>
30    string(2) "10"
31  }
32  [1]=>
33  object(GMP)#%d (1) {
34    ["num"]=>
35    string(1) "0"
36  }
37}
38array(2) {
39  [0]=>
40  object(GMP)#%d (1) {
41    ["num"]=>
42    string(1) "4"
43  }
44  [1]=>
45  object(GMP)#%d (1) {
46    ["num"]=>
47    string(2) "36"
48  }
49}
50array(2) {
51  [0]=>
52  object(GMP)#%d (1) {
53    ["num"]=>
54    string(2) "-4"
55  }
56  [1]=>
57  object(GMP)#%d (1) {
58    ["num"]=>
59    string(3) "-36"
60  }
61}
62array(2) {
63  [0]=>
64  object(GMP)#%d (1) {
65    ["num"]=>
66    string(1) "5"
67  }
68  [1]=>
69  object(GMP)#%d (1) {
70    ["num"]=>
71    string(3) "375"
72  }
73}
74array(2) {
75  [0]=>
76  object(GMP)#%d (1) {
77    ["num"]=>
78    string(1) "3"
79  }
80  [1]=>
81  object(GMP)#%d (1) {
82    ["num"]=>
83    string(2) "19"
84  }
85}
86
87Warning: gmp_rootrem(): Can't take even root of negative number in %s on line %d
88bool(false)
89array(2) {
90  [0]=>
91  object(GMP)#%d (1) {
92    ["num"]=>
93    string(1) "0"
94  }
95  [1]=>
96  object(GMP)#%d (1) {
97    ["num"]=>
98    string(1) "0"
99  }
100}
101
102Warning: gmp_rootrem(): The root must be positive in %s on line %d
103bool(false)
104
105Warning: gmp_rootrem(): The root must be positive in %s on line %d
106bool(false)
107