1
0
mirror of https://github.com/danog/math.git synced 2025-01-22 13:41:12 +01:00

Fix NativeCalculator::cmp() implementation

This was returning negative numbers other than -1 and positive numbers other than 1.
This commit is contained in:
Benjamin Morel 2015-06-21 13:55:44 +02:00
parent 32e898a3c2
commit 1c7902cd48

View File

@ -66,6 +66,12 @@ class NativeCalculator extends Calculator
$result = 1;
} else {
$result = strcmp($aDig, $bDig);
if ($result < 0) {
$result = -1;
} elseif ($result > 0) {
$result = 1;
}
}
return $aNeg ? -$result : $result;