Assert_equal not evaluating to TRUE

I have the following assert_equal in my unit test:

assert_equal 65000.0, do_calc

And get this Failure message back:

<65000.0> expected but was
<65000.0>.

How can that be ??? Has anybody seen this before?

Thanks
Joerg

On 12 Sep 2006, at 11:21, Joerg D. wrote:

How can that be ??? Has anybody seen this before?

You’re working with floats, which you can’t reliably compare with
==. Check out assert_in_delta instead.

if do_calc does floating-point math, there’s a chance that you have
floating-point errors. its neither your code nor ruby, but a problem
with
floating points and binary representation in general, since there are
some
numbers that cant be presented in binary, they are just rounded to be
approx. the right value. for more info on that, google is your friend,
since
i dont really know how to explain that in english :slight_smile:

2006/9/12, Joerg D. [email protected]:


Michael S. [email protected]

www.siebert-wd.de - Gedanken lesen
www.stellar-legends.de - Weltraum-Browsergame im Alpha-Stadium