/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
thisSignum = this.signum(); if (thisSignum != subtrahend.signum()) { tempBI = Multiplication.multiplyByPositiveInt(this.getUnscaledValue(), 10) .add(BigInteger.valueOf(thisSignum)); } else { tempBI = this.getUnscaledValue().subtract(BigInteger.valueOf(thisSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9));
tempBI = Multiplication.multiplyByPositiveInt(larger.getUnscaledValue(),10) .add(BigInteger.valueOf(largerSignum)); } else { tempBI = larger.getUnscaledValue().subtract( BigInteger.valueOf(largerSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI,10) .add(BigInteger.valueOf(largerSignum * 9));
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
/** * Multiplies a number by a power of five. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code int} exponent * @return {@code val * 5<sup>exp</sup>} */ static BigInteger multiplyByFivePow(BigInteger val, int exp) { // PRE: exp >= 0 if (exp < fivePows.length) { return multiplyByPositiveInt(val, fivePows[exp]); } else if (exp < bigFivePows.length) { return val.multiply(bigFivePows[exp]); } else {// Large powers of five return val.multiply(bigFivePows[1].pow(exp)); } } }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
/** * Multiplies a number by a power of ten. * This method is used in {@code BigDecimal} class. * @param val the number to be multiplied * @param exp a positive {@code long} exponent * @return {@code val * 10<sup>exp</sup>} */ static BigInteger multiplyByTenPow(BigInteger val, long exp) { // PRE: exp >= 0 return ((exp < tenPows.length) ? multiplyByPositiveInt(val, tenPows[(int)exp]) : val.multiply(powerOf10(exp))); }
thisSignum = this.signum(); if (thisSignum != subtrahend.signum()) { tempBI = Multiplication.multiplyByPositiveInt(this.getUnscaledValue(), 10) .add(BigInteger.valueOf(thisSignum)); } else { tempBI = this.getUnscaledValue().subtract(BigInteger.valueOf(thisSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9));
thisSignum = this.signum(); if (thisSignum != subtrahend.signum()) { tempBI = Multiplication.multiplyByPositiveInt(this.getUnscaledValue(), 10) .add(BigInteger.valueOf(thisSignum)); } else { tempBI = this.getUnscaledValue().subtract(BigInteger.valueOf(thisSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9));
thisSignum = this.signum(); if (thisSignum != subtrahend.signum()) { tempBI = Multiplication.multiplyByPositiveInt(this.getUnscaledValue(), 10) .add(BigInteger.valueOf(thisSignum)); } else { tempBI = this.getUnscaledValue().subtract(BigInteger.valueOf(thisSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9));
thisSignum = this.signum(); if (thisSignum != subtrahend.signum()) { tempBI = Multiplication.multiplyByPositiveInt(this.getUnscaledValue(), 10) .add(BigInteger.valueOf(thisSignum)); } else { tempBI = this.getUnscaledValue().subtract(BigInteger.valueOf(thisSignum)); tempBI = Multiplication.multiplyByPositiveInt(tempBI, 10) .add(BigInteger.valueOf(thisSignum * 9));