From: Minh Tran Date: 2008-07-02T21:48:31+09:00 Subject: Re: Arithmetic oddity It still look odd as the value in s[2] is 2.0 which doesn't seems to have any rounding problem. In any case is there any workaround to fix get the condition as true ? Eleanor McHugh wrote: > On 2 Jul 2008, at 12:30, Minh Tran wrote: >> Does anyone know why s[2] == s[1] + s[0] is false ? > If you check in IRB you'll find that ((2.0 ** 0.5) ** 2.0) == 2.0 > returns false. That will be due to rounding errors in performing the > sequence of floating point operations. > > > Ellie > > Eleanor McHugh > Games With Brains > http://slides.games-with-brains.net > ---- > raise ArgumentError unless @reality.responds_to? :reason -- Posted via http://www.ruby-forum.com/.