Making an integer from a float


#1

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!


#2

Yeah #to_i is what youre looking for.

http://www.ruby-doc.org/docs/ProgrammingRuby/

-h


#3

Float.round will return the floor or ceil appropriately.
-Linda