From: Siep Korteling Date: 2010-03-03T02:27:31+09:00 Subject: Re: Increase significant digits in Float Xavier Noria wrote: > On Tue, Mar 2, 2010 at 5:00 PM, Jason Lillywhite > wrote: > >> Thank you! I forgot that IRB is returning a truncated string to the >> screen. > > That 15 is hard-coded in the definition of Float#to_s. Yes, and exposing more digits is not accurate: puts "%.70f"%(4.005 / 7) #=>0.5721428571428571752122138605045620352029800415039062500000000000000000 require 'bigdecimal' a = BigDecimal.new("4.005") b = a/7 puts b #=>0.572142857142857142857143E0 p b.precs #=>[24, 32] #first number is the number of significant digits in b; the second number is the maximum precision my system can handle (not sure about this). The float is bogus after the 16th digit. hth, Siep -- Posted via http://www.ruby-forum.com/.