From: Jeff Mitchell Date: 2004-04-22T11:33:44+09:00 Subject: Re: 5.000...007.to_s => "5" --- nobu.nokada@softhome.net wrote: > Hi, > > At Thu, 22 Apr 2004 04:36:05 +0900, > Jeff Mitchell wrote in [ruby-talk:97924]: > > This fixes 1.000..7 but does not fix two other cases I didn't mention, > > > > arda:~/cur/ruby> ./ruby -e 'puts 1.00000000000004.to_s' > > 1.00000000000004 > > arda:~/cur/ruby> ./ruby -e 'puts 1.000000000000004.to_s' > > 1 > > arda:~/cur/ruby> ./ruby -e 'puts 1.0000000000000004.to_s' > > 1.0 > > arda:~/cur/ruby> ./ruby -e 'puts 1.99999999999999.to_s' > > 1.99999999999999 > > arda:~/cur/ruby> ./ruby -e 'puts 1.999999999999999.to_s' > > 2 > > arda:~/cur/ruby> ./ruby -e 'puts 1.9999999999999999.to_s' > > 2.0 > > Hmmm..., I didn't consider about upper boundary. > Still more to come :) Here's a MIME-64 containing 8 marshalled Floats: BAhmGjI0LjAwMDAwMDAwMDAwMDAwNAAAAQQIZhoyNy45OTk5OTk5OTk5OTk5OTYA//8ECGYaNDQu MDAwMDAwMDAwMDAwMDA3AAABBAhmGjQ1Ljk5OTk5OTk5OTk5OTk5MwD//wQIZho0OC4wMDAwMDAw MDAwMDAwMDcAAAEECGYaNTEuOTk5OTk5OTk5OTk5OTkzAP//BAhmGjU0LjAwMDAwMDAwMDAwMDAw NwAAAQQIZho4My45OTk5OTk5OTk5OTk5ODYA//8= File.open(ARGV.shift) { |file| begin while a = Marshal.load(file) puts "#{a.class} #{a}" end rescue EOFError end } Output should be: Float 24 Float 28 Float 44 Float 46 Float 48 Float 52 Float 54 Float 84 Oddly enough, with your patch the first two floats are fixed, showing 24.0 and 28.0 (which is entirely a coincidence; this list didn't exist when I came up with the original numbers). The rest are as shown. I'd have used ruby's mime-types but I couldn't get it to compile :/ __________________________________ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25� http://photos.yahoo.com/ph/print_splash