From: Daniel Finnie Date: 2006-12-04T11:27:14+09:00 Subject: Re: number format You can use the number.round method, but this doesn't take a number of decimal places. To round 1.234 to 1.23 use this code: x = 1.234 x = x * 100 # -> 123.4 x = x.round -> 123 x = x / 100.0 => 1.23 At least, that's the best method I can find from the Ruby docs... Dan Li Chen wrote: > Hi all, > > I have a number, for example, 1.123456789. What is the Ruby way to > change it into whatever number of floating points such as 1.12, > 1.123,1.1234568 or 1.12345679. > > Thanks, > > Li >