thanks for clarification ... have found some further explanations/
solutions and will change my testing-logic.

On Jan 23, 5:55 pm, Frederick Cheung <[email protected]>
wrote:
> On 23 Jan 2009, at 16:49, jzimmek wrote:
>
>
>
> > some of my tests failed when comparing two floats.
>
> > the comparison of:
>
> > 1.1035 == 1.0035 + 0.1
>
> > evaluates to false - i do not really understand why.
>
> > must depend on the value range, because
>
> > 1.103 == 1.003 + 0.1
>
> basically because 0.1 cannot be exactly represented in binary.
>
> assert_in_delta is good for this sort of stuff.
>
> Fred
>
>
>
> > evaluates to true.
>
> > would be great if anyone could help me getting this working and maybe
> > giving an explanation why ruby do not handle the == operator for float
> > as one would expect (coming from java).
>
> > tested on:
>
> > 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
>
> > regards
> > jan zimmek
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to