Integer type addition

@param  NI $a first operand
@param  NI $b second operand

@return IntType
770528
public function intAdd(NI $a, NI $b)
    {
        list($a, $b) = $this->checkIntTypes($a, $b);

        return new IntType($a() + $b());
    }
1002492
public static double mod(double a, double b) {
		int n = (int)(a/b);
		
		a -= n*b;
		if (a < 0)
			return a + b;
		return a;
	}
1216999
public static function add($int1, $int2)
    {
        if (!static::is($int1) || !static::is($int2)) {
            throw new \InvalidArgumentException("The \$int1 and \$int2 parameters must be of type int.");
        }

        return ($int1 + $int2);
    }
815066
protected function checkRationalTypes(NumericTypeInterface $a, NumericTypeInterface $b)
    {
        $a1 = ($a instanceof RationalType ? $a : $a->asRational());
        $b1 = ($b instanceof RationalType ? $b : $b->asRational());

        return [$a1, $b1];
    }
1166653
public static function int_mul($a, $b)
    {
        $result = 0;
        while ($b != 0) {
            // Iterate the loop till b==0
        if ($b & 01) {                // is $b odd?
          $result = self::int_add($result, $a); // int_add result
        }
            $a <<= 1;               // Left shifting the value contained in 'a' by 1
                                    // multiplies a by 2 for each loop
        $b >>= 1;                   // Right shifting the value contained in 'b' by 1.
        }

        return $result;
    }
540777
public function compare(NumericTypeInterface $a, NumericTypeInterface $b)
    {
        return $this->compEngine->compare($a, $b);
    }
1024289
public function call($a, $b)
    {
        return $a * ($b / $this->gcdMath->call($a, $b));
    }
1207008
public static function MOD($a = 1, $b = 1)
    {
        $a = PHPExcel_Calculation_Functions::flattenSingleValue($a);
        $b = PHPExcel_Calculation_Functions::flattenSingleValue($b);

        if ($b == 0.0) {
            return PHPExcel_Calculation_Functions::DIV0();
        } elseif (($a < 0.0) && ($b > 0.0)) {
            return $b - fmod(abs($a), $b);
        } elseif (($a > 0.0) && ($b < 0.0)) {
            return $b + fmod($a, abs($b));
        }

        return fmod($a, $b);
    }
804453
public function floatSub(NI $a, NI $b)
    {
        list($a, $b) = $this->checkFloatTypes($a, $b);
        return new FloatType($a() - $b());
    }
570142
private function doAdd(string $a, string $b) : string
    {
        $length = $this->pad($a, $b);

        $carry = 0;
        $result = '';

        for ($i = $length - $this->maxDigits;; $i -= $this->maxDigits) {
            $blockLength = $this->maxDigits;

            if ($i < 0) {
                $blockLength += $i;
                $i = 0;
            }

            $blockA = \substr($a, $i, $blockLength);
            $blockB = \substr($b, $i, $blockLength);

            $sum = (string) ($blockA + $blockB + $carry);
            $sumLength = \strlen($sum);

            if ($sumLength > $blockLength) {
                $sum = \substr($sum, 1);
                $carry = 1;
            } else {
                if ($sumLength < $blockLength) {
                    $sum = \str_repeat('0', $blockLength - $sumLength) . $sum;
                }
                $carry = 0;
            }

            $result = $sum . $result;

            if ($i === 0) {
                break;
            }
        }

        if ($carry === 1) {
            $result = '1' . $result;
        }

        return $result;
    }
988968
public BiFunction<Integer, Integer, Short> addition() {
        return (a, b) -> (short) Math.min(a, 255);
    }
716623
public function floatPow(FloatType $a, NI $exp)
    {
        if ($exp instanceof RationalType) {
            $b = RationalTypeFactory::fromFloat($a());
            return $this->rationalPow($b, $exp)->asFloatType();
        }

        if ($exp instanceof ComplexType) {
            return $this->floatComplexPow($a(), $exp);
        }

        //int and float types
        $p = pow($a(), $exp());

        return new FloatType($p);
    }
918869
public function compute(DecimalNumber $a, DecimalNumber $b)
    {
        if (function_exists('bcmul')) {
            return $this->computeUsingBcMath($a, $b);
        }

        return $this->computeWithoutBcMath($a, $b);
    }
641192
protected int ceil(int a, int b)
    {
        int m = 0;
        if (a % b > 0)
        {
            m = 1;
        }
        return a / b + m;
    }
1327552
public static function unsignedRightShift(int $a, int $b) : int
    {
        return (
            $a >= 0
            ? $a >> $b
            : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1))
        );
    }
1281841
public static function intcmp($a, $b) {
		return ($a - $b) ? ($a - $b) / abs($a - $b) : 0;
	}
591240
public function intDiv(NI $a, NI $b)
    {
        $ra = RationalTypeFactory::create($a);
        $rb = RationalTypeFactory::create($b);
        return $this->rationalDiv($ra, $rb);
    }