/*
(non-Javadoc)
@see javax.money.MonetaryAmount#multiply(Number)
196067
@Override
    public RoundedMoney multiply(Number multiplicand) {
        BigDecimal bd = MoneyUtils.getBigDecimal(multiplicand);
        if (isOne(bd)) {
            return this;
        }
        BigDecimal dec = number.multiply(bd, Optional.ofNullable(
                monetaryContext.get(MathContext.class)).orElse(MathContext.DECIMAL64));
        return new RoundedMoney(dec, currency, rounding).with(rounding);
    }
398848
public RoundedMoney pow(int n) {
        MathContext mc = monetaryContext.get(MathContext.class);
        if(mc==null){
            mc = MathContext.DECIMAL64;
        }
        return new RoundedMoney(number.pow(n, mc),
                currency, rounding).with(rounding);
    }
1199869
@Override
    public RoundedMoney divide(Number divisor) {
        BigDecimal bd = MoneyUtils.getBigDecimal(divisor);
        if (isOne(bd)) {
            return this;
        }
        BigDecimal dec = number.divide(bd, Optional.ofNullable(monetaryContext.get(RoundingMode.class)).
                orElse(RoundingMode.HALF_EVEN));
        return new RoundedMoney(dec, currency, rounding).with(rounding);
    }
434379
@Override
    public Money multiply(double multiplicand) {
    	NumberVerifier.checkNoInfinityOrNaN(multiplicand);
        if (multiplicand == 1.0d) {
            return this;
        }
        return multiply(new BigDecimal(String.valueOf(multiplicand)));
    }
513592
@Override
    public RoundedMoney divide(Number divisor) {
        BigDecimal bd = MoneyUtils.getBigDecimal(divisor);
        if (isOne(bd)) {
            return this;
        }
        RoundingMode rm = monetaryContext.get(RoundingMode.class);
        if(rm==null){
            rm = RoundingMode.HALF_EVEN;
        }
        BigDecimal dec = number.divide(bd, rm);
        return new RoundedMoney(dec, currency, rounding).with(rounding);
    }
1368732
@Override
    public MonetaryAmount apply(MonetaryAmount amount) {
        requireNonNull(amount, "Amount required.");
        NumberValue num = amount.getNumber();
        BigDecimal one = ONE.setScale(num.getScale() < 5 ? 5 : num.getScale(), HALF_EVEN);
        BigDecimal reciprocal = one.divide(num.numberValue(BigDecimal.class), HALF_EVEN);
        return amount.getFactory().setNumber(reciprocal).create();
    }
157823
public static MonetaryAmount sum(MonetaryAmount a, MonetaryAmount b){
        MoneyUtils.checkAmountParameter(Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency()));
        return a.add(b);
    }
677148
protected final void multiply() {
		final int step = blockStripeSize, blockSize = blockStripeSize * blockStripeSize;

		for (int m = fromM; m < toM; m += step) {
			final int aRows = matrixA.layout.getRowsInBlock(m);

			for (int k = fromK; k < toK; k += step) {
				final int bCols = matrixB.layout.getColumnsInBlock(k);

				final double[] cBlock = new double[aRows * bCols];

				for (int n = fromN; n < toN; n += step) {

					// ensure a and b are in optimal block order before
					// multiplication
					final double[] aBlock = matrixA.layout.toRowMajorBlock(matrixA, m, n);
					final double[] bBlock = matrixB.layout.toColMajorBlock(matrixB, n, k);

					if (aBlock != null && bBlock != null) {
						if (aBlock.length == blockSize && bBlock.length == blockSize) {
							multiplyAxB(aBlock, bBlock, cBlock, step);
						} else {
							int aCols = aBlock.length / aRows;
							int bRows = bBlock.length / bCols;
							verifyTrue(aCols == bRows, "aCols!=bRows");
							multiplyRowMajorTimesColumnMajorBlocks(aBlock, bBlock, cBlock, aRows,
									aCols, bCols);
						}
					}
				}

				matrixC.addBlockData(m, k, cBlock);
			}
		}
	}
1021095
@Override
  public ByteAmount multiply(int factor) {
    checkArgument(value <= Long.MAX_VALUE / factor,
        String.format("Multiplying %s by %d would exceed Long.MAX_LONG", this, factor));
    return ByteAmount.fromBytes(value * factor);
  }
1060767
@Override
    public RoundedMoney with(MonetaryOperator operator) {
        Objects.requireNonNull(operator);
        try {
            return RoundedMoney.from(operator.apply(this));
        } catch (MonetaryException | ArithmeticException e) {
            throw e;
        } catch (Exception e) {
            throw new MonetaryException("Query failed: " + operator, e);
        }
    }
120869
public void increment(T item, double amount) {
    counts.put(item, counts.get(item) + amount);
    totalCount += amount;
  }
910911
@Override
    public Money[] divideAndRemainder(double divisor) {
        if (NumberVerifier.isInfinityAndNotNaN(divisor)) {
            Money zero = Money.of(0, getCurrency());
            return new Money[]{zero, zero};
        }
        return divideAndRemainder(new BigDecimal(String.valueOf(divisor)));
    }
1149485
public static <T extends Transform> T multiply (
        double m00, double m01, double m10, double m11, double tx, double ty, AffineTransform b, T into) {
        return multiply(m00, m01, m10, m11, tx, ty, b.m00, b.m01, b.m10, b.m11, b.tx, b.ty, into);
    }
821032
public RoundedMoney pow(int n) {
        return new RoundedMoney(number.pow(n, Optional.ofNullable(
                monetaryContext.get(MathContext.class)).orElse(MathContext.DECIMAL64)),
                currency, rounding).with(rounding);
    }
688341
@Override
	public MonetaryAmount apply(MonetaryAmount amount) {
		Objects.requireNonNull(amount, "Amount required.");
		return amount.multiply(permilValue);
	}
1366768
function multiplyByNumber(num, x, base) {
  if (num < 0) return null;
  if (num == 0) return [];
  var result = [];
  var power = x;

  while (true) {
    if (num & 1) {
      result = add(result, power, base);
    }

    num = num >> 1;
    if (num === 0) break;
    power = add(power, power, base);
  }

  return result;
}
598959
@Override
    public Money scaleByPowerOfTen(int power) {
        return new Money(this.number.scaleByPowerOfTen(power), getCurrency(),
                monetaryContext);
    }