Divide

@param mixed $arg1
@param mixed $arg2
@param int $scale
@return string
188640
public static function divide($arg1, $arg2, $scale = null) : string {
		return self::__operator('bcdiv', $arg1, $arg2, $scale ?? self::$scale);
	}
208869
public static function sub($n1, $n2, $round = false)
    {
        $difference = bcsub($n1, $n2, self::$scale);

        return $round ? self::round($difference) : (float)$difference;
    }
702976
public static function Comp($op1, $op2, $scale = null)
    {
        $op1 = self::exponent($op1, $scale);
        $op2 = self::exponent($op2, $scale);
        return bccomp($op1, $op2, $scale);
    }
1292961
private function mul($s1, $s2, $scale) {
        if ($this->bcmath) return bcmul($s1, $s2, $scale);
        else return $this->scale($s1 * $s2, $scale);
    }
69725
private function valueWithMinScale(int $scale) : string
    {
        $value = $this->value;

        if ($this->value !== '0' && $scale > $this->scale) {
            $value .= \str_repeat('0', $scale - $this->scale);
        }

        return $value;
    }
717260
private function divide($stepSize)
    {
        $half = floor($stepSize / 2);

        if ($half < 1) {
            return;
        }

        for ($x = $half; $x < $this->size; $x += $stepSize) {
            for ($y = $half; $y < $this->size; $y += $stepSize) {
                $this->square($x, $y, $half, $this->getOffset($stepSize));
            }
        }

        $this->divide($half);
    }
1328798
public static function mul($float1, $float2)
    {
        if (!static::is($float1) || !static::is($float2)) {
            throw new \InvalidArgumentException("The \$float1 and \$float2 parameters must be of type float.");
        }

        return ($float1 * $float2);
    }
1300494
public static function div($num1, $num2)
    {
        if (!static::is($num1) || !static::is($num2)) {
            throw new \InvalidArgumentException("The \$num1 and \$num2 parameters must be numeric.");
        }

        if ($num2 == 0) {
            throw new \InvalidArgumentException("Cannot divide by zero. The \$num2 parameter cannot be zero.");
        }

        return ($num1 / $num2);
    }
1287104
@Override
  public Double divide2(Double arg1, long arg2) {
    if (arg1 == null) {
      return Double.NaN;
    } else {
      return arg1 / arg2;
    }
  }
650060
public function divide($b)
    {
        switch (true) {
            case $b instanceof Matrix:
                $c = $this->divideMatrix($b);
                break;

            case $b instanceof ColumnVector:
                $c = $this->divideColumnVector($b);
                break;
            
            case $b instanceof Vector:
                $c = $this->divideVector($b);
                break;

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

            default:
                throw new InvalidArgumentException('Cannot divide matrix'
                    . ' with a ' . gettype($b) . '.');
        }

        return $c;
    }
904383
public function add($arg1) : \Object\Value\Math {
		\Math::add2($this->result, $arg1, $this->scale);
		return $this;
	}
1266501
protected function _splitArgs($args)
    {
        $out = [];
        foreach ($args as $arg) {
            if (strpos($arg, ':') !== false) {
                list($key, $value) = explode(':', $arg);
                if (in_array($value, ['true', 'false'])) {
                    $value = $value === 'true';
                }
                $out[$key] = $value;
            } else {
                $out[] = $arg;
            }
        }

        return $out;
    }
941340
public static function Div($op1, $op2, $scale = null)
    {
        $op1 = self::exponent($op1, $scale);
        $op2 = self::exponent($op2, $scale);
        return bcdiv($op1, $op2, $scale);
    }
646860
public static function Pow($op1, $op2, $scale = null)
    {
        $op1 = self::exponent($op1, $scale);
        $op2 = self::exponent($op2, $scale);
        return bcpow($op1, $op2, $scale);
    }
438103
public function ceil($scale = 0): Decimal
    {
        if ($scale >= $this->scale) {
            return $this;
        }

        if ($this->isNegative()) {
            return self::fromString(\bcadd($this->value, '0', $scale));
        }

        return $this->innerTruncate($scale);
    }
55566
public function sin(int $scale = null): Decimal
    {
        // First normalise the number in the [0, 2PI] domain
        $x = $this->mod(DecimalConstants::PI()->mul(Decimal::fromString("2")));

        // PI has only 32 significant numbers
        $scale = (null === $scale) ? 32 : $scale;

        return self::factorialSerie(
            $x,
            DecimalConstants::zero(),
            function ($i) {
                return ($i % 2 === 1) ? (
                ($i % 4 === 1) ? DecimalConstants::one() : DecimalConstants::negativeOne()
                ) : DecimalConstants::zero();
            },
            $scale
        );
    }
1017344
public function add($arg1, $arg2 = null) {

        if(isset($arg2)) {

			$this->set("var[$arg1]", $arg2);

            return $arg2;

        } else {

        	if(is_array($arg1)) {

	            foreach($arg1 as $name => $value) {

	                $this->set("var[$name]", $value);
	            }

                return $arg1;
        	}
		}
	}