Newbie in C#, trying to work out a simple calculation.
float old x=300
float Distance=300
float pitch=0.8
int sign=1
new x= old x - (sign * (Distance % pitch) * 0.5 f)
The value generated by program for new x is 299.6
(which I don't understand).
The value for (Distance % pitch)
is 0.7999955
. If you calculate manually 300 modulo 0.8
is 0
. I am guessing modulo function behaves differently for float values but i don't know how. Or it is calculated as 300 percentage of 0.8?
Explanation on this will be much appreciated.