File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
gmp /
tests /
bug52906.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:47:56 2012 UTC (12 years, 6 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
Bug #52906 gmp_mod returns negative result when non-negative is expected
--SKIPIF--
<?php if (!extension_loaded("gmp")) print "skip"; ?>
--FILE--
<?php
$vals = array(
array(7, 3),
array(2, 7),
array(12, 7),
array(-2, 7),
array(-12, 7),
array(2, -7),
array(12, -7),
array(-2, -7),
array(-12, -7),
);
foreach($vals as $data) {
echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod($data[0], $data[1]));
echo "\n";
echo "{$data[0]}%{$data[1]}=".gmp_strval(gmp_mod(gmp_init($data[0]), gmp_init($data[1])));
echo "\n";
}
echo "Done\n";
?>
--EXPECTF--
7%3=1
7%3=1
2%7=2
2%7=2
12%7=5
12%7=5
-2%7=5
-2%7=5
-12%7=2
-12%7=2
2%-7=2
2%-7=2
12%-7=5
12%-7=5
-2%-7=5
-2%-7=5
-12%-7=2
-12%-7=2
Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>