From: Dejan Dimic Date: 2008-08-05T04:23:39+09:00 Subject: Re: Whose fault is my problem? On Aug 4, 6:23 pm, Gregory Brown wrote: > On Mon, Aug 4, 2008 at 11:50 AM, William Rutiser wrote: > > Ruby has a variety of means to extend or modify assert_equal to work this > > way. > > Test::Unit actually has an assertion for this, better to use it than > roll your own: > > require "test/unit" > > class FooTest < Test::Unit::TestCase > >   def test_in_delta >     assert_in_delta 17.001, 17.00100001, 0.0001 >   end > > end > > --- > Killer Ruby PDF Generation named after a magnificent sea creature:http://github.com/sandal/prawn| Non-tech stuff at:http://metametta.blogspot.com Just to add that this is an universal programming issue present in all programming languages that deals with floats without any assumptions. You should get used to it and always kip in mind when using floats, doubles, double precision or currency data types even some date and time data types that internally stored as double or float. That is one of the small things that make our lives more interesting. :-)