Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why RPN (postfix notation)?

notation postfix rpn
0
Posted

Why RPN (postfix notation)?

0

RPN (postfix notation) was chosen by the developers because it is very simple to implement. Unlike infix notation, in RPN there is no need for parenthesis nor is there any kind of operator order. This means that there is no need to ‘parse’ the expressions. RPN is also more standardised than infix notation, take a look at the following example: -22, or -2^2 as it is sometimes written. Now, on a normal algebraic calculator there is a good chance that if you type it in you will get -4 as your answer! This is because the calculator uses BODMAS, which states that exponents should be evaluated before ‘-‘ (minus/subtraction) signs, which causes the calculator to square two (four) and then put ‘-‘ at the font, giving -4. This can be fixed by forcing the calculator to evaluate -2 first, and is done by putting the -2 in parenthesis, giving (-2)2. This is only the case for some calculators, not all, which can cause problems if you are not used to the calculator which you are using. In RPN it is a

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123