a == b = 0
a < b = -1
a > b = 1

@param NumericTypeInterface $a
@param NumericTypeInterface $b

@return int
540777
public function compare(NumericTypeInterface $a, NumericTypeInterface $b)
    {
        return $this->compEngine->compare($a, $b);
    }
1296742
public static function zeroFill($a, $b)
    {
        $z = hexdec(80000000);
        if ($z & $a) {
            $a = ($a>>1);
            $a &= (~$z & 0xffffffff);
            $a |= 0x40000000;
            $a = ($a >> ($b-1));
        } else {
            $a = ($a >> $b);
        }
        return $a;
    }
303077
static protected function sortInjection(BasicInjectionContract $a, BasicInjectionContract $b)
    {
        if ($a->priority() == $b->priority()) {
            return 0;
        }

        return ($a->priority() < $b->priority()) ? - 1 : 1;
    }
319084
public static function compare(array $a, array $b)
    {
        if ($a['quality'] !== $b['quality']) {
            return $a['quality'] > $b['quality'] ? -1 : 1;
        }

        if ($a['index'] !== $b['index']) {
            return $a['index'] > $b['index'] ? 1 : -1;
        }

        return 0;
    }
997486
protected function compare($a, $b)
    {
        switch ($this->operator) {
            case '=':
            case '==': return $a == $b;
            case '!=': return $a != $b;
            case '<':  return $a < $b;
            case '>':  return $a > $b;
            case '<=': return $a <= $b;
            case '>=': return $a >= $b;
        }
    }
746416
public function getSum($a = 0, $b = 0)
    {
        if (!is_numeric($a) || !is_numeric($b)) {
            throw new \Exception('Given parameters need to be numeric');
        }

        return (float)($a + $b);
    }
717276
public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b)
    {
        if ($a->isNegative()) {
            if ($b->isNegative()) {
                // if both numbers are negative,
                // we can just add them as positive numbers and then invert the sign
                // f(x, y) = -(|x| + |y|)
                // eg. f(-1, -2) = -(|-1| + |-2|) = -3
                // eg. f(-2, -1) = -(|-2| + |-1|) = -3
                return $this
                    ->computeWithoutBcMath($a->toPositive(), $b->toPositive())
                    ->invert();
            }
            // if the number is negative and the addend positive,
            // perform an inverse subtraction by inverting the terms
            // f(x, y) = y - |x|
            // eg. f(-2, 1) = 1 - |-2| = -1
            // eg. f(-1, 2) = 2 - |-1| = 1
            // eg. f(-1, 1) = 1 - |-1| = 0
            return $b->minus(
                $a->toPositive()
            );
        }

        if ($b->isNegative()) {
            // if the number is positive and the addend is negative
            // perform subtraction instead: 2 - 1
            // f(x, y) = x - |y|
            // f(2, -1) = 2 - |-1| = 1
            // f(1, -2) = 1 - |-2| = -1
            // f(1, -1) = 1 - |-1| = 0
            return $a->minus(
                $b->toPositive()
            );
        }

        // optimization: 0 + x = x
        if ('0' === (string) $a) {
            return $b;
        }

        // optimization: x + 0 = x
        if ('0' === (string) $b) {
            return $a;
        }

        // pad coefficients with leading/trailing zeroes
        list($coeff1, $coeff2) = $this->normalizeCoefficients($a, $b);

        // compute the coefficient sum
        $sum = $this->addStrings($coeff1, $coeff2);

        // both signs are equal, so we can use either
        $sign = $a->getSign();

        // keep the bigger exponent
        $exponent = max($a->getExponent(), $b->getExponent());

        return new DecimalNumber($sign . $sum, $exponent);
    }
802959
public function compare(Node $a, Node $b) {
    $valA = $this->getSortkeyValue($a);
    $valB = $this->getSortkeyValue($b);
    if ($valA == $valB) { return 0; }
    return ($valA > $valB) ? 1 : -1;
  }
691703
public static function scalar(array $a, array $b)
    {
        $product = 0;
        foreach ($a as $index => $value) {
            if (is_numeric($value) && is_numeric($b[$index])) {
                $product += $value * $b[$index];
            }
        }

        return $product;
    }
411991
public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b, $precision = self::DEFAULT_PRECISION)
    {
        if ((string) $b === '0') {
            throw new DivisionByZeroException();
        }

        return new DecimalNumber((string) bcdiv($a, $b, $precision));
    }
310962
public static function matchLanguage($a, $b) {
        $a = explode('-', $a);
        $b = explode('-', $b);
        for ($i=0, $n=min(count($a), count($b)); $i<$n; $i++) {
            if ($a[$i] !== $b[$i]) break;
        }
        return $i === 0 ? 0 : (float) $i / count($a);
    }
766185
public function comp($a, $b)
    {
        return bccomp($this->bcNormalize($a), $this->bcNormalize($b));
    }
672438
public static function compareSequential(Call $a, Call $b): int
    {
        return $a->sequenceNumber() <=> $b->sequenceNumber();
    }
146564
public function sortMenuEntries($a, $b)
    {
        if ($a->getName() > $b->getName()) {
            return 1;
        } else if ($a->getName() < $b->getName()) {
            return -1;
        } else {
            return 0;
        }
    }
905707
public function compareWithoutBcMath(DecimalNumber $a, DecimalNumber $b)
    {
        $signCompare = $this->compareSigns($a->getSign(), $b->getSign());
        if ($signCompare !== 0) {
            return $signCompare;
        }

        // signs are equal, compare regardless of sign
        $result = $this->positiveCompare($a, $b);

        // inverse the result if the signs are negative
        if ($a->isNegative()) {
            return -$result;
        }

        return $result;
    }
313772
final public function cmp(string $a, string $b) : int
    {
        $this->init($a, $b, $aDig, $bDig, $aNeg, $bNeg);

        if ($aNeg && ! $bNeg) {
            return -1;
        }

        if ($bNeg && ! $aNeg) {
            return 1;
        }

        $aLen = \strlen($aDig);
        $bLen = \strlen($bDig);

        if ($aLen < $bLen) {
            $result = -1;
        } elseif ($aLen > $bLen) {
            $result = 1;
        } else {
            $result = $aDig <=> $bDig;
        }

        return $aNeg ? -$result : $result;
    }
91183
public static function compare(Version $a, Version $b)
    {
        $aValues = $a->numeric();
        $bValues = $b->numeric();

        foreach (array_keys(self::$ordinality) as $key) {
            $aVal = $aValues[$key];
            $bVal = $bValues[$key];

            if ($aVal < $bVal) {
                return -1;
            } elseif ($aVal > $bVal) {
                return 1;
            }
        }
        return 0;
    }