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:
parent
32e898a3c2
commit
1c7902cd48
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user