Problem with simple mathematic calculation.

 


Hello,

I just found that there is an error on simple mathematic calculation like below:

Print(" 80/100=" + (80/100));

I couldn't get the answer right 0.8,
instead it returns 0.

Anyone have face the similar problem?

 

You have to doubletostr(80/100) with the Print

 
You are trying to divide 2 integers, the result is an integer (in this case zero). If both or at least one of the numbers is double, the result will be double. Any of the following will work:
  • 80.0/100
  • 80/100.0
  • 80.0/100.0
 
gordon wrote >>
You are trying to divide 2 integers, the result is an integer (in this case zero). If both or at least one of the numbers is double, the result will be double. Any of the following will work:
  • 80.0/100
  • 80/100.0
  • 80.0/100.0


Oic.

Thanks for help and reply.