Unity thinks that 14 = 15?


Debug.Log ((int) ((0.4875f + 0.4125f - 0.75f) * 100f));

Why does Unity tell me 14? Any way to fix that? I give you that numbers as a result from other formulas, so you can count it easily, I… I just don’t know what to think.

Btw Unity converts -15 float into -15 int normally, but for some odd reason it thinks that 15 float is 14 int.

Simple casting a float to (int) loses the fractional part due to integer truncation
The result of your calculation is something like 14.99997f, so (int)14.99997f = 14.

If you want the answer 15, try Mathf.Round() instead.