On Feb 8, 2007, at 12:50 PM, Drew Raines wrote:

> Wolfgang NŠŇasi-Donner wrote:
>
>> Drew Raines schrieb:
>>> Can I workaround this?
>>
>> If you always expect a result for which "x * 100" is a number without
>> a fractional part, you can use "(-39.30 * 100).round" instead.
>
> Hal Fulton[1] gave me a good idea:
>
>   class Float
>     FUDGE = 1e-3
>     def ==(x)
>       (self-x).abs < FUDGE
>     end
>   end
>
> This is better for my tests anyway.  assert_equal now works on its
> own.

Test::Unit already includes an assertion just for this.  It's called  
assert_in_delta().

James Edward Gray II