I’m getting different results in Unity(using C#), than my formula in OpenOffice Calc.
(Formula with inputs and results above.)
public static int Formula(int i, int j)
{
return i - ((int)((float)(j / 2) * ((j - 1) * 6) + 1) - ((j - 1) * 6)) + 1;
}
(Formula in Unity)
For example if I have i = 9 and j = 3 returns 9 in Unity while I am expecting it to return 3, while i = 2, j = 2 or j=24, j=4 returns the correct value.
Is there something difference about how the formula is calculated in C# or do I have to restructure the formula.