From: Michael Libby Date: 2008-12-10T23:46:54+09:00 Subject: Re: Displaying long floats without scientific notation On Wed, Dec 10, 2008 at 8:28 AM, sa 125 wrote: > Hello - > > I need to display the long forms of numbers read from a database table > without scientific notation. > > For example, a number read as 1.5e-6 should be displayed as "0.0000015", > and so on. > > Is there an easy way to do this in ruby, or do I need to write a > function to do it? I was thinking about using a lot of > number.to_s.split... Use a formatted print statement. printf("%.7f\n", 0.0000015) You will need to adjust the first parameter to taste. You can read about string formatting at your command line with: ri Kernel.sprintf There is also an alternative syntax, see: ri String.% -Michael -- Michael C. Libby www.mikelibby.com