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

This commit is contained in:
terrafrost 2019-05-24 21:45:59 -05:00
parent c839297065
commit 64542e699f

View File

@ -296,7 +296,14 @@ class GMP extends Engine
*/
public function compare(GMP $y)
{
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;
}
/**