so 4 / 100 = 0? how could i..

Back to topics list To post a new topic, please log in or register
avatar
211
Subgenius 2015.08.27 07:56
 

make a point decimal from two integers?


ive got two integer variables

iMultiplier 100 or 10000

and

iRange 4


i was hoping to divide the iRange by the iMultiplier to get the decimal of the price to add

or subtract from a price but what was happening is 0 and not 0.04..


just try

Print(4/100); the answer is 0

oh yea and also try Print(NormalizeDouble(4/100,2));

avatar
Moderator
3427
GumRai 2015.08.27 08:24 #
 
Subgenius:

just try

Print(4/100); the answer is 0

oh yea and also try Print(NormalizeDouble(4/100,2));

It is because the result is cast to an integer

try

4/100.0

so that 1 of the numbers is a double 

avatar
211
Subgenius 2015.08.27 08:28 #
 
GumRai:

It is because the result is cast to an integer

try

4/100.0


thx

avatar
13009
Back to topics list  

To add comments, please log in or register