Subtracts another distance from this instance and returns a new instance
with the difference.

@param Distance $b Distance to subtract

@return static Difference of the two distances
430928
public function sub(Distance $b)
    {
        return Distance::m(bcsub($this->m, $b->m), static::$s);
    }
802737
public function dist(&$A, &$B)
    {
        $h1 = $this->simhash($A);
        $h2 = $this->simhash($B);
        $d = 0;
        for ($i=0;$i<$this->length;$i++) {
            if ($h1[$i]!=$h2[$i])
                $d++;
        }

        return $d;
    }
1280143
public Matrix subtract(Matrix B)
    {
        Matrix toReturn = getThisSideMatrix(B);
        toReturn.mutableSubtract(1.0, B);
        return toReturn;
    }
696039
public function subtract(self $y): self
    {
        $value = \gmp_sub($this->value, $y->value);

        return self::createFromGMPResource($value);
    }
922188
public function notEqual($b)
    {
        switch (true) {
            case $b instanceof Vector:
                $c = $this->notEqualVector($b);
                break;

            case $b instanceof Matrix:
                $c = $this->notEqualMatrix($b);
                break;

            case is_int($b) or is_float($b):
                $c = $this->notEqualScalar($b);
                break;

            default:
                throw new InvalidArgumentException('Cannot compare vector'
                    . ' to a ' . gettype($b) . '.');
        }

        return $c;
    }
285125
public function computeUsingBcMath(DecimalNumber $a, DecimalNumber $b)
    {
        $precision1 = $a->getPrecision();
        $precision2 = $b->getPrecision();
        return new DecimalNumber((string) bcadd($a, $b, max($precision1, $precision2)));
    }
796972
public function subtract($value)
    {
        if (!$value instanceof self) {
            $value = new self($value, $this->getScale(), false);
        }

        $newValue = bcsub($this->getValue(), $value->getValue(), $this->getScale());

        return $this->assignValue($newValue);
    }
1353486
public static function diff(DateTime $a, DateTime $b, bool $absolute = false) : self
    {
        $microseconds = $b->microsecond() - $a->microsecond();
        
        if ($absolute) {
            $microseconds = abs($microseconds);
        }
        
        $diff = $a->toInternalDateTime()->diff($b->toInternalDateTime(), $absolute);
        
        return new static($diff, $microseconds);
    }
1214750
public function subtract(Money $money)
    {
        $this->assertSameCurrency($money);
        $amount = $this->amount->sub($money->amount, $this->getInnerPrecision());

        return $this->newInstance($amount);
    }
734420
public double distance(Instance first, Instance second) {
    return Math.sqrt(distance(first, second, Double.POSITIVE_INFINITY));
  }
1048798
public static function subtract(\CArray $a, \CArray $b): \CArray
    {
        return parent::subtract($a, $b);
    }
476131
public function add(string $a, string $b, $distance, bool $addInverseEdge = true) : Graph
    {
        if (!is_numeric($distance)) {
            return false;
        }
        $distance = floatval($distance);
        $this->total_cost   += $distance;
        $this->nodes[$a][$b] = $distance;

        if ($addInverseEdge) {
            $this->nodes[$b][$a] = $distance;
        }
        return $this;
    }
58645
public static double longitudeDiff(double a, double b) {
        a = to180(a);
        b = to180(b);
        return Math.abs(to180(a - b));
    }
1079286
public function distance(array $a, array $b): float
    {
        if (count($a) !== count($b)) {
            throw InvalidArgumentException::arraySizeNotMatch();
        }

        $distance = 0;

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

        return sqrt((float) $distance);
    }
438374
public static function subtract(Expr $left, Expr $right) : BinOp
    {
        return new BinOp($left, BinOp::SUBTRACT, $right);
    }
106440
public static int distance (int a, int b, int N)
    {
        return (a > b) ? Math.min(a-b, b+N-a) : Math.min(b-a, a+N-b);
    }
82868
public function sub($a, $b)
    {
        $a = $this->convert($a);
        $b = $this->convert($b);
        switch ($this->arbitrate($a, $b)) {
            case 'int':
                return $this->calcEngine->intSub($a, $b);
            case 'float':
                return $this->calcEngine->floatSub($a, $b);
            case 'whole':
                return $this->calcEngine->wholeSub($a, $b);
            case 'natural':
                return $this->calcEngine->naturalSub($a, $b);
            case 'rational':
                return $this->calcEngine->rationalSub($a, $b);
            case 'complex':
                return $this->calcEngine->complexSub($a, $b);
            case 'complex:numeric':
                return $this->calcEngine->complexSub($a, $b->asComplex());
            case 'numeric:complex':
                return $this->calcEngine->complexSub($a->asComplex(), $b);
        }
    }