I am trying to find out modulo in c# as i know remainder is obtained on doing a modulo b= remainder so here a%b=remainder the same i tried to do like this:
var distanceFactor = slider.Value % distance;
But the value on debugging of slider.Value= 2.0 and distance =0.1 and distanceFactor i found surprisingly is 0.0999999999.. and i was expecting it to be 0.
Is it due to var ? what could be the reason for this non zero value.?
And how to do the solution of this problem ? because on rounding of this 0.0999999999 becomes 0.1 ans my control never go in condition if(distanceFactor==0) (and roundoff is also necessary in current situation).Is there any alternative to achieve it ?