Example: calculation of intermediate results
The following example shows how the compiler performs an arithmetic statement as a succession of operations, storing intermediate results as needed.
COMPUTE Y = A + B * C - D / E + F ** G
The result is calculated in the following order:
- Exponentiate
F
byG
yielding ir1. - Multiply
B
byC
yielding ir2. - Divide
E
intoD
yielding ir3. - Add
A
toir2
yielding ir4. - Subtract ir3 from ir4 yielding ir5.
- Add ir5 to ir1 yielding
Y
.