RPN notation conversion

Soldato
Joined
18 Jan 2006
Posts
3,158
Location
Norwich
I've got a very major headache here :p
I don't suppose someone could convert this RPN expression to 'standard' notation, and try to explain why?
Code:
time 1.15 mod 0 - 10 *

Just very confused as to where the heck I need to place the brackets, so that I actually get the expected result.

Cheers

-Leezer-
 
In infix notation:

Code:
((time mod 1.15) - 0) * 10

I think. It doesn't make much sense though.

Anyway, here's the RPN expression with brackets inserted:

Code:
((time 1.15 mod) 0 -) 10 *

You read from the end of the expression, taking the star operator first. Read back one position to find 10; this is the second operand for the star operator. Move back one more position to find the first operand, which itself is an RPN expression.

In this expression, the operator is the minus sign, and its operands are (time 1.15 mod) and 0. Expanding the first operand as before, the operator here is mod, and its operands are time and 1.15.

As I said, though, this doesn't seem to make much sense, as modular arithmetic is only defined for integers.
 
Last edited:
Back
Top Bottom