Multiplies two BigIntegers.

@param BigInteger $x

@return BigInteger
198830
public function multiply(self $x)
    {
        $value = gmp_mul($this->value, $x->value);

        return self::createFromGMPResource($value);
    }
527930
public static double var(int[] x) {
        if (x.length < 2) {
            throw new IllegalArgumentException("Array length is less than 2.");
        }

        double sum = 0.0;
        double sumsq = 0.0;
        for (int xi : x) {
            sum += xi;
            sumsq += xi * xi;
        }

        int n = x.length - 1;
        return sumsq / n - (sum / x.length) * (sum / n);
    }
481302
public static int log_2( int x ) {
		int shift;
		/* Scale x to range 1.0 <= x < 2.0 */
		shift = IBXM.FP_SHIFT;
		while( x < IBXM.FP_ONE ) {
			x <<= 1;
			shift--;
		}
		while( x >= ( IBXM.FP_ONE << 1 ) ) {
			x >>= 1;
			shift++;
		}
		return ( IBXM.FP_ONE * shift ) + eval_table( log_2_table, x - IBXM.FP_ONE );
	}
1255340
@Override
    public double hedge(double x) {
        return Op.isLE(x, 0.5)
                ? 2.0 * x * x
                : 1.0 - 2.0 * (1.0 - x) * (1.0 - x);
    }
367317
public function iushln($bits) {
        assert(is_integer($bits) && $bits >= 0);
        if ($bits < 54) {
            $this->bi = $this->bi->mul(1 << $bits);
        } else {
            $this->bi = $this->bi->mul((new BigInteger(2))->pow($bits));
        }
        return $this;
    }
1231112
public double[] presolve(double[] x){
		if(x.length != originalN){
			throw new IllegalArgumentException("wrong array dimension: " + x.length);
		}
		double[] presolvedX = Arrays.copyOf(x, x.length);
		for(int i=0; i<presolvingStack.size(); i++){
			presolvingStack.get(i).preSolve(presolvedX);
		}
		double[] ret = new double[presolvedN];
		int cntPosition = 0;
		for(int i=0; i<presolvedX.length; i++){
			if(indipendentVariables[i]){
				ret[cntPosition] = presolvedX[i];
				cntPosition++;
			}
		}
		if(this.T != null){
			//rescaling has been done: x = T.x1
			for(int i=0; i<ret.length; i++){
				ret[i] = ret[i] / T.getQuick(i);
			}
		}
		return ret;
	}
579288
public BigDecimal calculate(BigDecimal x, MathContext mathContext) {
		BigDecimal acceptableError = ONE.movePointLeft(mathContext.getPrecision() + 1);

		PowerIterator powerIterator = createPowerIterator(x, mathContext);
		
		BigDecimal sum = BigDecimal.ZERO;
		BigDecimal step;
		int i = 0;
		do {
			BigRational factor = getFactor(i);
			BigDecimal xToThePower  = powerIterator.getCurrentPower();
			powerIterator.calculateNextPower();
			step = factor.getNumerator().multiply(xToThePower, mathContext).divide(factor.getDenominator(), mathContext);
			i++;

			if (calculateInPairs) {
				xToThePower  = powerIterator.getCurrentPower();
				powerIterator.calculateNextPower();
				factor = getFactor(i);
				BigDecimal step2 = factor.getNumerator().multiply(xToThePower, mathContext).divide(factor.getDenominator(), mathContext);
				step = step.add(step2, mathContext);
				i++;
			}

			sum = sum.add(step, mathContext);
			//System.out.println(sum + " " + step);
		} while (step.abs().compareTo(acceptableError) > 0);
		
		return sum.round(mathContext);
	}
1010103
public static double factorial(int x) {
    double result = 1.0;
    for (int i=x; i>1; i--) {
      result *= i;
    }
    return result;
  }
1081100
public function modnn($x)
    {
        while ($x >= $this->nn) {
            $x -= $this->nn;
            $x = ($x >> $this->mm) + ($x & $this->nn);
        }

        return $x;
    }
737966
public static function mul($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);
    }
1167355
function bitwise_xor($x)
    {
        switch (MATH_BIGINTEGER_MODE) {
            case self::MODE_GMP:
                $temp = new static();
                $temp->value = gmp_xor(gmp_abs($this->value), gmp_abs($x->value));
                return $this->_normalize($temp);
            case self::MODE_BCMATH:
                $left = $this->toBytes();
                $right = $x->toBytes();

                $length = max(strlen($left), strlen($right));

                $left = str_pad($left, $length, chr(0), STR_PAD_LEFT);
                $right = str_pad($right, $length, chr(0), STR_PAD_LEFT);

                return $this->_normalize(new static($left ^ $right, 256));
        }

        $length = max(count($this->value), count($x->value));
        $result = $this->copy();
        $result->is_negative = false;
        $result->value = array_pad($result->value, $length, 0);
        $x->value = array_pad($x->value, $length, 0);

        for ($i = 0; $i < $length; ++$i) {
            $result->value[$i]^= $x->value[$i];
        }

        return $this->_normalize($result);
    }
1213792
public function sqrt() : BigInteger
    {
        if ($this->value[0] === '-') {
            throw new NegativeNumberException('Cannot calculate the square root of a negative number.');
        }

        $value = Calculator::get()->sqrt($this->value);

        return new BigInteger($value);
    }
500177
public function interpolate( $x )
	{
		$sum	= 0;
		$values	= array_values( $this->data );
		$expressions	= $this->getExpressions();
		for( $i=0; $i<count( $expressions ); $i++ )
		{
			$expression	= $expressions[$i];
			$formula	= new Alg_Math_Formula( $expression, array( "x" ) );
			$value	= $formula->getValue( 2 );
			$sum	+= $values[$i] * $value;
		}
		return $sum;
	}
75264
public function multiply($x, $y) {
		$this->width *= $x;
		$this->height *= $y;
		return $this;
	}
302557
public static int nextPow2(int x) {
		if (x < 1)
			throw new IllegalArgumentException("x must be greater or equal 1");
		if ((x & (x - 1)) == 0) {
			if( x == 1 )
				return 2;
			return x; // x is already a power-of-two number
		}
		x |= (x >>> 1);
		x |= (x >>> 2);
		x |= (x >>> 4);
		x |= (x >>> 8);
		x |= (x >>> 16);
		x |= (x >>> 32);
		return x + 1;
	}
669307
public function plus($that) : BigRational
    {
        $that = BigRational::of($that);

        $numerator   = $this->numerator->multipliedBy($that->denominator);
        $numerator   = $numerator->plus($that->numerator->multipliedBy($this->denominator));
        $denominator = $this->denominator->multipliedBy($that->denominator);

        return new BigRational($numerator, $denominator, false);
    }
1205866
private function bigMul($num1, $num2)
    {
        if ($num1 < 10 || $num2 < 10) {
            return $num1 * $num2;
        }

        $m = max([$this->getBit($num1), $this->getBit($num2)]);
        $m2 = floor($m / 2);

        $high1 = $this->getHighBitPart($num1, $m2);
        $low1 = $this->getLowBitPart($num1, $m2);

        $high2 = $this->getHighBitPart($num2, $m2);
        $low2 = $this->getLowBitPart($num2, $m2);

        $z2 = $this->bigMul($high1, $high2);
        $z0 = $this->bigMul($low1, $low2);
        $z1 = $this->bigMul(($high1 + $low1), ($high2 + $low2)) - $z2 - $z0;
        return $z2 * pow(10, 2 * $m2) + $z1 * pow(10, $m2) + $z0;
    }