From: Marnen Laibow-Koser Date: 2009-10-29T03:52:43+09:00 Subject: Re: Ruby can't subtract ? Aldric Giacomoni wrote: > Matthew K. Williams wrote: >>> irb(main):016:0> 123.6 - 123.0 >>> => 0.599999999999994 >>> >>> That's a little strange.. Isn't it? >> >> No, it's not. Welcome to the wonderfully confusing world of floating >> point math... > > Oh, thanks. Can I have some pop-corn and an introductory pamphlet before > I bash my head against the wall? :) Most languages these days use IEEE 754-style floats, which leads to the imprecision you saw. http://c2.com/cgi/wiki?IeeeSevenFiftyFour Don't use floats for serious arithmetic. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen@marnen.org -- Posted via http://www.ruby-forum.com/.