getting some strange output for subtraction... why?
darshanrt
Posts: 4
hello everyone,
first of all thanks aton for your previous replys. I have one more problem if any one of you can help me with it..!!
let me explain it with example:
I have two inputs one is in_1 = 2.10 and·in_2 =·1.90. now as I am using basic stamp i did in_1 = 210/100 and in_2 = 190/100. and I am expecting my result but some strange answer coming like "1"···. can you tell me how can I get the answer as 0.2 on the screen..??
I am new to basic stamp language so pls bare some silly questions from my side. thanks once again.
regards,
Darshan
first of all thanks aton for your previous replys. I have one more problem if any one of you can help me with it..!!
let me explain it with example:
I have two inputs one is in_1 = 2.10 and·in_2 =·1.90. now as I am using basic stamp i did in_1 = 210/100 and in_2 = 190/100. and I am expecting my result but some strange answer coming like "1"···. can you tell me how can I get the answer as 0.2 on the screen..??
I am new to basic stamp language so pls bare some silly questions from my side. thanks once again.
regards,
Darshan
Comments
The BASIC Stamp only knows integers, so you have to keep your variables in whole integer form at all times. Here's how you might display your result as a decimal. It displays the integer part first, then the decimal point, then the remainder from dividing by 100 as a two-digit number:
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 10/18/2007 2:24:28 AM GMT
thanks.. even I was thinking the same way but you cleared my all doubts... except one... now what if I want to use them (in_1, in_2 and even the result) will they be the carried fwd as 2.10, 1.90 and 0.20...??
again bare my stupid questions...!!
Thanks aton,
Regards,
Darshan