Could anyone tell me why these two modulus calculations yield two different outcomes? I just need to blame someone or something but me for all those hours I lost finding this bug.
public void test1()
{
int stepAmount = 100;
float t = 0.02f;
float remainder = t % (1f / stepAmount);
Debug.Log("Remainder: " + remainder);
// Remainder: 0.01
float fractions = 1f / stepAmount;
remainder = t % fractions;
Debug.Log("Remainder: " + remainder);
// Remainder: 0
}
Using VS-2017 V15.3.5