From: James Edward Gray II Date: 2005-11-01T07:49:50+09:00 Subject: Re: Newbie: How to format a number to always show two decimals? On Oct 31, 2005, at 4:47 PM, i.v.r. wrote: > Hi, > > This seems like a simple task, yet I've been unable to accomplish > it. Somewhere I read you could do: > > num.round(2).to_s("F") > > But that is not working, as the round method doesn't accept any > parameters. > > Could someone help me figure this out? >> sprintf("%.2f", 1.012345) => "1.01" >> # ... or ... ?> "%.2f" % 1.012345 => "1.01" Hope that helps. James Edward Gray II