Dermot Moynihan wrote:
> Been doing a bit of reading on 'ceil' and 'floor' and am wondering if
> you have to know the actual number you are going to be working on in
> order to use them.

Not at all.
x = 3.2
y = 15.7 * x
p y, y.ceil
#=> 50.24
#=> 51


> I would have thought this would be a fairly mundane task. After all if
> one wants 1 and a bit ice creams or whatever, he must get two not one.
> So, rounding up is surely pretty important.

You're right, it is mundane. Ruby provides convenient methods for
making the mundane easy.


> I suppose what I need is some way of saying:
> IF the answer is a floating point decimal number round it up.
> If there is nothing after the decimal point (e.g. 46.0) leave it alone (46).

As Jeroen pointed out, ceil is the answer here.