Compares two arbitrary precision numbers.

@param  string  $a  The first number.
@param  string  $b  The second number.
@return integer
766185
public function comp($a, $b)
    {
        return bccomp($this->bcNormalize($a), $this->bcNormalize($b));
    }
1218298
public function Subtract($a, $b)
    {
        $this->preOpMethodParamsCheck(array($a, $b));

        return $this->math->sub($a, $b);
    }
666859
public function computeWithoutBcMath(DecimalNumber $a, DecimalNumber $b)
    {
        $aAsString = (string) $a;
        $bAsString = (string) $b;

        // optimization: if either one is zero, the result is zero
        if ('0' === $aAsString || '0' === $bAsString) {
            return new DecimalNumber('0');
        }

        // optimization: if either one is one, the result is the other one
        if ('1' === $aAsString) {
            return $b;
        }
        if ('1' === $bAsString) {
            return $a;
        }

        $result = $this->multiplyStrings(
            ltrim($a->getCoefficient(), '0'),
            ltrim($b->getCoefficient(), '0')
        );

        $sign = ($a->isNegative() xor $b->isNegative()) ? '-' : '';

        // a multiplication has at most as many decimal figures as the sum
        // of the number of decimal figures the factors have
        $exponent = $a->getExponent() + $b->getExponent();

        return new DecimalNumber($sign . $result, $exponent);
    }
466928
public static function compare(string $a, string $b): string
    {
        return static::makeBin($a, 16) === static::makeBin($b, 16);
    }
659692
protected function sortKeyLength($a, $b)
    {
        if (strlen($a) == strlen($b))
            return 0;
        if (strlen($a) > strlen($b))
            return -1;
        return 1;
    }
290626
public function compare($a, $b)
    {
        return strcoll(Horde_String::lower($a[$this->key], true, 'UTF-8'), Horde_String::lower($b[$this->key], true, 'UTF-8'));
    }
982310
public function dist(&$A, &$B)
    {
        if (is_int(key($A)))
            $v1 = array_count_values($A);
        else
            $v1 = &$A;
        if (is_int(key($B)))
            $v2 = array_count_values($B);
        else
            $v2 = &$B;

        $r = array();
        foreach ($v1 as $k=>$v) {
            $r[$k] = $v;
        }
        foreach ($v2 as $k=>$v) {
            if (isset($r[$k]))
                $r[$k] -= $v;
            else
                $r[$k] = $v;
        }

        return sqrt(
            array_sum(
                array_map(
                    function ($x) {
                        return $x*$x;
                    },
                    $r
                )
            )
        );
    }
809796
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b)
    {
        if ($a->getRow() < $b->getRow()) {
            return -1;
        } elseif ($a->getRow() > $b->getRow()) {
            return 1;
        } elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) {
            return -1;
        } else {
            return 1;
        }
    }
288243
public static function CodepointEqual( $a, $b )
	{
		if ( $a instanceof Undefined || $b instanceof Undefined )
		{
			return Undefined::getValue();
		}

	    $s1 = $a . "";
	    $s2 = $b . "";
		return strcmp( $s1, $s2 ) == 0;
	}
244342
public function similarity(&$A, &$B)
    {
        return ($this->length-$this->dist($A,$B))/$this->length;
    }
1161542
public static function compareTimezonesByOffset($a, $b) {

		$dta = new DateTime(null, new DateTimeZone($a));
		$dtb = new DateTime(null, new DateTimeZone($b));

		if ($dta->getOffset() == $dtb->getOffset()) {
			return (strcmp($a, $b) < 0) ? -1 : 1;
		}
		return ($dta->getOffset() < $dtb->getOffset()) ? -1 : 1;
	}
1021860
public function compute($a, $b)
    {
        $score = 2 * Product::scalar($a, $b);
        $squares = Product::scalar($a, $a) + Product::scalar($b, $b);
        $result = exp(-$this->gamma * ($squares - $score));

        return $result;
    }
906931
private function compare_float( $a, $b ) {
		$a = number_format( $a, 4 );
		$b = number_format( $b, 4 );
		if ( 0 === $a - $b ) {
			return 0;
		} elseif ( $a - $b < 0 ) {
			return -1;
		} else {
			return 1;
		}
	}
16868
private static function slowEquals($a, $b)
    {
        $diff = strlen($a) ^ strlen($b);
        for ($i = 0; $i < strlen($a) && $i < strlen($b); $i++) {
            $diff |= ord($a[$i]) ^ ord($b[$i]);
        }

        return $diff === 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;
    }
41342
public function compute(array $a, array $b) : float
    {
        $distance = 0.;

        foreach ($a as $i => $value) {
            $distance += ($value - $b[$i]) ** 2;
        }

        return sqrt($distance);
    }
78791
public function dist(&$A, &$B)
    {
        $l1 = strlen($A);
        $l2 = strlen($B);
        $l = min($l1,$l2);
        $d = 0;
        for ($i=0;$i<$l;$i++) {
            $d += (int) ($A[$i]!=$B[$i]);
        }

        return $d + (int) abs($l1-$l2);
    }