From: Gregory Brown Date: 2007-08-11T10:46:22+09:00 Subject: Re: Quick Float question On 8/10/07, Cliff Rowley wrote: > Hank Gong wrote: > > This is because the 3.33333333333333 is not the exact value you got > > from 10.0/3.0. Ruby store more information you can't not see. > > So if you want to compare the float, you can write it as > > (10.0/3.0 - 3.3333333333).abs <= 0.0001 > > > This is what I thought. Thanks for clarifying that. I need it > primarily for unit testing, I'll try this technique and see how I go. assert_in_delta 3.3333333333, 10.0/3.0, 0.0001 -greg