On Tuesday 21 August 2001 09:12 pm, you wrote:
> Hello all,
>
> Forgive my ignorance, but given that we do,
> after all, store numbers in binary, how can
> this code *possibly* print "yes" (as it does)?
>
>     x = 1.0/3.0
>     y = 3.0*x
>     if y == 1.0
>       puts "yes"
>     else
>       puts "no"
>     end
>
> Thanks,
> Hal Fulton

Because any epsilon smaller than around 5e-17 is lost by the binary 
representation of 1.0,  (1.0/3.0)*3.0 turns back into 1.0

irb(main):051:0> [1.0/3.0*3.0].pack('d').unpack('H*')
["000000000000f03f"]

irb(main):052:0> [1.0].pack('d').unpack('H*')
["000000000000f03f"]

-- 
Ned Konz
currently: Stanwood, WA
email:     ned / bike-nomad.com
homepage:  http://bike-nomad.com