--1926193751-781334832-11888418926091
Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-781334832-1188841892=:26091"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1926193751-781334832-11888418926091
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

On Tue, 4 Sep 2007, Matthias Wächter wrote:

> Folks,
>
> While we had a discussion around the magic number 0.06, I tried to
> output arbitrary floating point numbers and was puzzled about the
> imprecision of my ruby executable (or a library it uses for this
> task) on my Windows machine (Athlon XP, Ruby 1.8.6 win32 installer
> from ruby-lang.org):
>
> C:\>ruby --version
> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
> C:\>irb
> irb(main):001:0> "%.60f" % 0.1
> => "0.100000000000000010000000000000000000000000000000000000000000"
> irb(main):002:0> 0.1.to_s
> => "0.1"
>
> I mean, irrespective of wrongly outputting 0.1 as "0.01" using
> .to_s, it cannot even correctly calculate the number using floating
> point printf-like string substitution! :(

Where does it output "0.01"?


David

-- 
* Books:
   RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242)
   RUBY FOR RAILS (http://www.manning.com/black)
* Ruby/Rails training
     & consulting:  Ruby Power and Light, LLC (http://www.rubypal.com)
--1926193751-781334832-11888418926091--
--1926193751-781334832-11888418926091--