0.06 == 0.06 returns false in Ruby?
- From: "Jason G." <jasonpurchase@xxxxxxxxx>
- Date: Fri, 31 Aug 2007 10:38:19 +0900
Hi
I wrote a simple test program, basically the program asks the user to
enter floats. the entered values shall be used as keys for Hash (the
values are irrelavent).
The program tries to find the lowest untaken key/float (floats are used
as keys).
please see attachment.
please run the prog, and enter the following:
0.01 - OK
0.02 - OK
0.03 - OK
0.04 - OK
0.05 - OK
0.06 - Problem
Can anyone explain to me what's going on here?
thanks
jason
Attachments:
http://www.ruby-forum.com/attachment/193/test.rb
--
Posted via http://www.ruby-forum.com/.
.
- Follow-Ups:
- Re: 0.06 == 0.06 returns false in Ruby?
- From: Peña, Botp
- Re: 0.06 == 0.06 returns false in Ruby?
- From: Dan Zwell
- Re: 0.06 == 0.06 returns false in Ruby?
- Prev by Date: Re: Why stack overflow with such a small stack?
- Next by Date: Re: 0.06 == 0.06 returns false in Ruby?
- Previous by thread: Any way to evaluate blocks using an arbitrary Binding?
- Next by thread: Re: 0.06 == 0.06 returns false in Ruby?
- Index(es):
Relevant Pages
|