hey, i have this line in my code:

```
holding[1] = Mathf.CeilToInt( (slots[counter][1]) / 2 );
```

basicly, if “slots[counter][1]” is a odd number, like 25, its rounded down 12, not up 13…

Have i misunderstood how “Mathf.CeilToInt” works?

hey, i have this line in my code:

```
holding[1] = Mathf.CeilToInt( (slots[counter][1]) / 2 );
```

basicly, if “slots[counter][1]” is a odd number, like 25, its rounded down 12, not up 13…

Have i misunderstood how “Mathf.CeilToInt” works?

The problem you’re experiencing here could just be a casting issue.

I’m assuming your *slots* array is storing int types here. If that’s the case, your division is being performed entirely as integers. Which means that 25 / 2, never becomes 12.5f as you are expecting as the argument to Mathf.CeilToInt, instead the result is just 12.

Here is some commented code showing your case and the way you expect.

```
// In this line, division is performed on integers.
// result = 12
int result = Mathf.CeilToInt(25 / 2);
// On the other hand here, it will work as you expect.
// result = 13.
int result = Mathf.CeilToInt((float)25 / 2);
```

Casting the left term of the division expression causes the division to be performed as float data types, rather than int.

25 / 2 = 12

25.0 / 2.0 = 12.5

CeilToInt(12) = 12

CeilToInt(12.5) = 13