public function gcd($that) : BigInteger
    {
        $that = BigInteger::of($that);

        if ($that->value === '0' && $this->value[0] !== '-') {
            return $this;
        }

        if ($this->value === '0' && $that->value[0] !== '-') {
            return $that;
        }

        $value = Calculator::get()->gcd($this->value, $that->value);

        return new BigInteger($value);
    }
public function gcd($that) : BigInteger
    {
        $that = BigInteger::of($that);

        if ($that->value === '0' && $this->value[0] !== '-') {
            return $this;
        }

        if ($this->value === '0' && $that->value[0] !== '-') {
            return $that;
        }

        $value = Calculator::get()->gcd($this->value, $that->value);

        return new BigInteger($value);
    }
public function gcd ( $ that ) : BigInteger { $ that = BigInteger :: of ( $ that ) ; if ( $ that -> value === '0' && $ this -> value [ 0 ] !== '-' ) { return $ this ; } if ( $ this -> value === '0' && $ that -> value [ 0 ] !== '-' ) { return $ that ; } $ value = Calculator :: get ( ) -> gcd ( $ this -> value , $ that -> value ) ; return new BigInteger ( $ value ) ; }
Returns the greatest common divisor of this number and the given one.

The GCD is always positive, unless both operands are zero, in which case it is zero.

@param BigNumber|number|string $that The operand. Must be convertible to an integer number.

@return BigInteger
Returns the greatest common divisor of this number and the given one .