Often times the ceil method is used for patterns that involve grouping. For example, if I have an array of objects and I want to group them in rows of 3, I might do this:

(@objects.size / 3.0).ceil

So if size returns 2, then the above expression returns 1.

Here’s my question. In terms of arithmetic, I dont understand why 3.0 must be used and not just 3. If I was to calculate 2/3.0 and 2/3 in a calculator, it returns same result, after all, since .0 is meaningless. Its like 3.00 or 3.0000 it all means the same. So why does ceil return different results with 2/3.0 and 2/3?

thanks for response