Math problem
I have these 3 variables:
Code:
a VAR WORD
b VAR WORD
a and b can be anywhere from 0 to 999.
I need to work out a way of displaying an a/b percentage on my LCD to 1 decimal place.
I thought of this;
Code:
a VAR WORD
b VAR WORD
pct VAR WORD
pct=(a*1000)/b
which would give me the percent, with the last decimal being the decimal place. But this wont work if a=999 becuase 999*1000 is lager than a WORD can be.
I'm using PBP 2.46 so I cant use LONGs.
Any ideas? I'm sure this is possible, but i'm having a brain freeze.
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Bookmarks