Float.round will return the floor or ceil appropriately.
-Linda
-----Original Message-----
From: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Henry Turner
Sent: Thursday, April 06, 2006 5:33 AM
To: rails@lists.rubyonrails.org
Subject: Re: [Rails] making an integer from a float
Yeah #to_i is what youre looking for.
http://www.ruby-doc.org/docs/ProgrammingRuby/
-h
On 4/6/06, sean colquhoun <seancolquhoun@gk-a.com>
wrote:> Does anybody know how to turn a floating-point number (i.e. 60.345) into
> an integer by cutting off or rounding the decimal portion? Either
> method, or both, would be quite welcome. Thanks! This forum rocks!
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails