Calculations with brackets
Posted: Thu Dec 23, 2010 8:51 am
I simulate the calculation in Flowcode 4 with variable I(byte):
I=8
I=6*(I/3)
This gives for me the unexpected results of I=16 instead of I=12. It looks like the brackets are not seen.
The following calculation :
I=8
I=I/3
I=6*I
This gives I=12 as expected.
I tried to check the C and asm files, but both looks correct. That means in asm first de division has been done before the multiplication.
Then I downloaded the program into PIC16F88, which shows as results of the first calculation the expected 12! That means the brackets in Flowcode 4 simulation are not seen. Be prepared!
Jan
I=8
I=6*(I/3)
This gives for me the unexpected results of I=16 instead of I=12. It looks like the brackets are not seen.
The following calculation :
I=8
I=I/3
I=6*I
This gives I=12 as expected.
I tried to check the C and asm files, but both looks correct. That means in asm first de division has been done before the multiplication.
Then I downloaded the program into PIC16F88, which shows as results of the first calculation the expected 12! That means the brackets in Flowcode 4 simulation are not seen. Be prepared!
Jan