From: Eric Anderson Date: 2004-10-14T22:34:39+09:00 Subject: Re: Rounding to X digits Eric Anderson wrote: > Obviously I could also enhance round to take an optional > argument but I wanted to see if there was an already existing function > in the Ruby std library that will do it for me. To follow up my own post. If there isn't a function like what I am looking for in the standard library, I am using the following to make it like I want. class Float alias :oldround :round def round( sd=0 ) return (self * (10 ** sd)).oldround.to_f / (10**sd) end end