Rounding up a floating point number to the nearest integer

I need to round up a floating point number to the nearest integer. So
2.3 would become 3 instead of 2 which is what happens if i use
2.3.round.

does anyone know of a simple way to do this?

if not could you please point my in the right direction for a more
complicated way.

Thank you.

On 7/13/07, dodgyboz [email protected] wrote:

Thank you.

Round will round to the nearest integer. This is not always down. The
builtin method :ceil is the one your after here.

2.3.ceil #=> 3

Cheers
Daniel

On Fri, 13 Jul 2007, dodgyboz wrote:

I need to round up a floating point number to the nearest integer. So
2.3 would become 3 instead of 2 which is what happens if i use
2.3.round.

does anyone know of a simple way to do this?

brains hgs 31 %> irb
irb(main):001:0> 2.3.ceil
=> 3
irb(main):002:0> quit
brains hgs 32 %>

    Hugh

On Jul 13, 2007, at 4:17 AM, Daniel N wrote:

Thank you.

Round will round to the nearest integer. This is not always down.
The builtin method :ceil is the one your after here.

2.3.ceil #=> 3

Cheers
Daniel

Make sure that, if you have negative values, that you understand that
“up” means “toward positive Infinity”

-2.3.ceil #=> -2

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Thanks