From: Chris Cummer Date: 2007-12-01T18:32:47+09:00 Subject: Re: Float Question On 1-Dec-07, at 12:30 AM, Armando Padilla wrote: > Hey Chris thanks for the feedback. Yea im using that but i was > looking for something built into the Float stack. Something along > the lines of Float.new(). > Basically something without the need to use sprintf. In that case the monkey-patch suggestions made by others would do the trick for you. I personally wouldn't like to see anything like this in the Float class proper since it really isn't part of the float itself but rather an operation on the string representation of it. Of the m-p suggestions made (is this question now mp-complete?), I like Pat Maddox's truncate() the best: > class Float > def truncate(places = 0) > return to_i if places == 0 > sprintf( "%0.#{places}f", self).to_f > end > end