Modified reversePolishNotation() method - use BigDecimal instead of Double