You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without this criterion (operatorStack.peek() == '^' ||) the following expression gives wrong result:
(5 * 2 ^ 3 * 2 + 2 * 3 % 2) * 4 is correctly 320, but without this criterion it is 1280, because 2 ^ 3 * 2 is evaluated as 2 ^ 6.
The text was updated successfully, but these errors were encountered:
Hi,
One criterion is missing before the 68th row, at the while loop premise. Instead of
while (!operatorStack.isEmpty() && (operatorStack.peek() == '*' || operatorStack.peek() == '/' || operatorStack.peek() == '%' )) { processAnOperator(operandStack, operatorStack); }
the correct version would be:
while(!operatorStack.isEmpty() && (operatorStack.peek() == '*' || operatorStack.peek() == '/' || operatorStack.peek() == '^' || operatorStack.peek() == '%')) { processAnOperator(operandStack, operatorStack); }
Without this criterion (operatorStack.peek() == '^' ||) the following expression gives wrong result:
(5 * 2 ^ 3 * 2 + 2 * 3 % 2) * 4 is correctly 320, but without this criterion it is 1280, because 2 ^ 3 * 2 is evaluated as 2 ^ 6.
The text was updated successfully, but these errors were encountered: