Mathfloor and Mathmod

 

Can someone please help. The following code when actually true does not give an answer at a difference of 20 but does when the difference is 40????

Yes all values are double

if(MathMod(newlevel-mhlevel,20.0)==0)
{ Print(" nl ",newlevel);
Print("mf ",MathFloor((newlevel-mhlevel)/20.0));
}

 
If newlevel-mhlevel equals -40 -20 0 20 40 60 80 100 etc.. the result is 0.
 

Thanks for replying.

Yes that is what i want but the code does not work for me. The levels are the current and a previous price * 10000 to make it easier.

For some reason the if statement is never true.

 

Make 20 and newlevl and mhlevel integers, not doubles...

or

if( NormalizeDouble( MathMod(newlevel-mhlevel,20.0), 0 ) == 0)

Reason: