From: Christophe Mckeon Date: 2008-12-20T04:51:29+09:00 Subject: Re: about Float and just in case you need further convincing, this is the scariest example i've ever seen. taken from Stefano Taschini's http://intervals.rubyforge.org/ Take into consideration the rather innocent looking function def f(x,y) (333.75-x**2)* y**6 + x**2 * (11* x**2 * y**2-121 * y**4 -2) + 5.5 * y**8 + x/(2*y) end We can calculate it for some specific x and y, f(77617.0,33096.0) # => 1.17260394005318 There is only one problem: this result is WRONG. The correct result can be obtained by calculating separately the numerator and denominator of f using integer arithmetic. def f_num(x,y) ((33375- 100 * x**2)* y**6 + 100 * x**2 * (11* x**2 * y**2-121 * y**4 -2) + 550 * y**8) * 2*y + 100 *x end def f_den(x,y) 200*y end f_num(77617, 33096).to_f / f_den(77617, 33096).to_f # => -0.827396059946821 _c -- Posted via http://www.ruby-forum.com/.