Raises an arbitrary precision number to an integer power.

@param  string $a  The number to raise to the power.
@param  string $b  The integer power
@return string     The result of the operation.
773859
public function Power($a, $b)
    {
        $this->preOpMethodParamsCheck(array($a, $b));

        return $this->math->power($a, $b);
    }
961051
public function greater($b)
    {
        switch (true) {
            case $b instanceof Vector:
                $c = $this->greaterVector($b);
                break;

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

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

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

        return $c;
    }
878201
public static function floorMod(int $a, int $b) : int
    {
        return (($a % $b) + $b) % $b;
    }
746416
public function getSum($a = 0, $b = 0)
    {
        if (!is_numeric($a) || !is_numeric($b)) {
            throw new \Exception('Given parameters need to be numeric');
        }

        return (float)($a + $b);
    }
306413
public function getRound( $precision = 0, $mode = PHP_ROUND_HALF_UP )
	{
		if ( $this->getIsDecimal() === false )
		{
			// return $this;
		}

		if ( $precision === false ) $precision = $this->scale( $this->_value );
		if ( is_null( $precision ) ) $precision = 0;
		// if( $precision < 0) $precision = 0;

		$factor = 1;

		// If the precision is negative create a factor
		if ( $precision < 0 )
		{
			$precision = abs( $precision );
			$factor = bcpow( 10, $precision, $precision );
			$precision = 0;
		}

		// Create a new decimal on which to perform rounding
		$rounder = $this->Div( $factor );

		$isHalf = false;
		$increment = "0";
		$number = $rounder->_value;
		$sign = "";

		if ( $mode == PHP_ROUND_HALF_EVEN || $mode == PHP_ROUND_HALF_ODD )
		{
			// These are only relevant if the precision rounds the least significant digit and that digit is 5.
			if ( $rounder->getDecimalIsHalf( $precision ) )
			{
				$isHalf = true;

				if ( $precision - 1 >= 0 )
				// if ( $this->getIntegerPart() != 0 )
				{
					if ( $rounder->getIsDecimalEven( $precision - 1) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? "-" : "";
							// The amount to add or substract is 1 at the digit position one above the $scale position
							// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
							// change is 0.1 or -0.1.
							$increment = $sign . bcpow( 10, "-$precision", $precision );

						}
					}
				}
				else
				{
					if ( $rounder->getIsIntegerEven( $precision ) )
					{
						if ( $mode == PHP_ROUND_HALF_ODD )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
					else
					{
						if ( $mode == PHP_ROUND_HALF_EVEN )
						{
							$sign = $rounder->getIsNegative() ? -1 : 1;
							$increment = 1 * $sign;
						}
					}
				}

			}
		}

		if ( $rounder->getIsNegative() && $mode == PHP_ROUND_HALF_UP )
		{
			$mode = PHP_ROUND_HALF_DOWN;
		// 	$mode = $mode == PHP_ROUND_HALF_UP
		// 		? PHP_ROUND_HALF_DOWN
		// 		: PHP_ROUND_HALF_UP;
		}

		// Round half-up or half-down according to the $mode
		if ( ! $isHalf && $rounder->getIsCloserToNext( $precision, $mode ) )
		{
			$decimalPart = $rounder->getDecimalPart();
			if ( strlen( $decimalPart > $precision ) )
			{
				$sign = $rounder->getIsNegative() ? "-" : "";
				// The amount to add or substract is 1 at the digit position one above the $scale position
				// If the scale is zero then the value change is 1 or -1.  If the scale is 1 then the
				// change is 0.1 or -0.1.
				$increment = $sign . bcpow( 10, "-$precision", $precision );
			}
		}

		$rounder = DecimalValue::FromValue( bcadd( $rounder->getValue(), $increment, $precision ) );
		if ( $factor > 1 )
		{
			$rounder = $rounder->Mul( $factor );
		}

		return $rounder;
		// return new DecimalValue( $number );
	}
93938
public static function equal( $a, $b, int $precision = 0 ): bool {
    return self::write( $a, $precision ) === self::write( $b, $precision );
  }
516731
public function intMul(NI $a, NI $b)
    {
        list($a, $b) = $this->checkIntTypes($a, $b);

        return new IntType($a() * $b());
    }
1265233
public static function add($a, $b)
    {
        if (function_exists('gmp_add')) {
            return gmp_add($a, $b);
        }

        return bcadd($a, $b, 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;
    }
197658
public function add($a, $b)
    {
        return bcadd($this->bcNormalize($a), $this->bcNormalize($b));
    }
691703
public static function scalar(array $a, array $b)
    {
        $product = 0;
        foreach ($a as $index => $value) {
            if (is_numeric($value) && is_numeric($b[$index])) {
                $product += $value * $b[$index];
            }
        }

        return $product;
    }
366479
public function pow($b)
    {
        switch (true) {
            case $b instanceof Vector:
                $c = $this->powVector($b);
                break;

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

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

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

        return $c;
    }
373427
public static function gcd($a, $b)
    {
        $sign = 1;
        if ($a < 0) $sign = -$sign;
        if ($b < 0) $sign = -$sign;

        while ($b != 0)
        {
            $m = $a % $b;
            $a = $b;
            $b = $m;
        }
        return $sign*abs($a);
    }
313772
final public function cmp(string $a, string $b) : int
    {
        $this->init($a, $b, $aDig, $bDig, $aNeg, $bNeg);

        if ($aNeg && ! $bNeg) {
            return -1;
        }

        if ($bNeg && ! $aNeg) {
            return 1;
        }

        $aLen = \strlen($aDig);
        $bLen = \strlen($bDig);

        if ($aLen < $bLen) {
            $result = -1;
        } elseif ($aLen > $bLen) {
            $result = 1;
        } else {
            $result = $aDig <=> $bDig;
        }

        return $aNeg ? -$result : $result;
    }
466928
public static function compare(string $a, string $b): string
    {
        return static::makeBin($a, 16) === static::makeBin($b, 16);
    }
1281841
public static function intcmp($a, $b) {
		return ($a - $b) ? ($a - $b) / abs($a - $b) : 0;
	}
190206
public function compute(array $a, array $b) : float
    {
        $a = Vector::quick($a);
        $b = Vector::quick($b);

        return 1. - ($a->dot($b) / ($a->l2Norm() * $b->l2Norm()));
    }