From: Harry Kakueki Date: 2009-08-05T10:06:12+09:00 Subject: Re: zero placeholder exponential sprintf? On Wed, Aug 5, 2009 at 7:00 AM, Bil Kleb wrote: > Hi, > > We have a request for 0.112345e+02 instead of, > > % ruby -e "puts '%.6e' % [ 1.123450e+2 ]" > 1.123450e+02 > > Possible? > > Thanks, > -- > Bil Kleb > http://fun3d.larc.nasa.gov > > I may be missing what you are after, but.... Does it need to be sprintf? require 'bigdecimal' p BigDecimal.new(1.12345e+2.to_s).to_s #=> "0.112345E3" Harry -- A Look into Japanese Ruby List in English http://www.kakueki.com/ruby/list.html