Download MetaTrader 5

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

To add comments, please log in or register
Brian Lillard
597
Brian Lillard  

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));

Keith Watford
Moderator
10376
Keith Watford  
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 

Brian Lillard
597
Brian Lillard  
GumRai:

It is because the result is cast to an integer

try

4/100.0


thx

To add comments, please log in or register