BigInteger: GMP engine didn't always return 1 or -1

This commit is contained in:
terrafrost 2019-05-26 12:14:44 -05:00
parent ade48c2cb1
commit 8b76e96b83

View File

@ -2727,7 +2727,14 @@ class Math_BigInteger
{
switch (MATH_BIGINTEGER_MODE) {
case MATH_BIGINTEGER_MODE_GMP:
return gmp_cmp($this->value, $y->value);
$r = gmp_cmp($this->value, $y->value);
if ($r < -1) {
$r = -1;
}
if ($r > 1) {
$r = 1;
}
return $r;
case MATH_BIGINTEGER_MODE_BCMATH:
return bccomp($this->value, $y->value, 0);
}