Code example for BigDecimal

Methods: subtract

0
 
	public void subtract() { 
		BigDecimal rhs = values.peek();
		values.pop();
		BigDecimal lhs = values.peek();
		BigDecimal result = lhs.subtract(rhs);
		values.replaceTop(result);
	} 
 
	public void factorial() { 
		BigDecimal operand = values.peek();
		BigDecimal result = BigDecimal.ONE;
		 
		while (operand.compareTo(BigDecimal.ONE) > 0) {
			result = result.multiply(operand);
			operand = operand.subtract(BigDecimal.ONE);
		} 
		 
		values.replaceTop(result);
	} 
Contextual code suggestions in your IDE  Get Codota for Java