xref: /PHP-8.3/ext/gmp/tests/gmp_lcm.phpt (revision e9f783fc)
1--TEST--
2gmp_lcm(): Least common multiple
3--EXTENSIONS--
4gmp
5--FILE--
6<?php
7
8var_dump(gmp_lcm(100, 77));
9var_dump(gmp_lcm(99, 77));
10var_dump(gmp_lcm(99, -77));
11var_dump(gmp_lcm(-99, -77));
12
13var_dump(gmp_lcm(gmp_init(99), gmp_init(77)));
14
15var_dump(gmp_lcm(93, 0));
16var_dump(gmp_lcm(0, 93));
17
18?>
19--EXPECT--
20object(GMP)#1 (1) {
21  ["num"]=>
22  string(4) "7700"
23}
24object(GMP)#1 (1) {
25  ["num"]=>
26  string(3) "693"
27}
28object(GMP)#1 (1) {
29  ["num"]=>
30  string(3) "693"
31}
32object(GMP)#1 (1) {
33  ["num"]=>
34  string(3) "693"
35}
36object(GMP)#3 (1) {
37  ["num"]=>
38  string(3) "693"
39}
40object(GMP)#3 (1) {
41  ["num"]=>
42  string(1) "0"
43}
44object(GMP)#3 (1) {
45  ["num"]=>
46  string(1) "0"
47}
48