From: Zsban Ambrus Date: 2004-05-06T22:20:46+09:00 Subject: Re: Bug in Float literal (1e-19 == 0) Re: 0.0 sign On Thu, May 06, 2004 at 07:13:57AM +0900, Tobias Peters wrote: > What I find much more problematic than 0.0 having a sign is that ruby treats > > 0.0000000000000000001 == 0.0 as true. > > If I've counted correct that should be 1 * 10^-19. Doubles can represent > Numbers down to approx. 10^-300. > > 1e-300 == 0.0 is false in ruby, as it should be. > > There must be a bug in the interpreter, where it reads Float literals. > > Tobias I think this might be a bug in the C library, not ruby. Don't take this for sure however. Why I think this is because something similar seems to occur in Perl too. I've written a japh "http://www.perlmonks.com/index.pl?node_id=330784". I've checked that it works on machines with either endianness (linux-ix86 and sun4-solaris-sparc). However, I've got reports saying that it won't work on their machine. One report, "http://www.perlmonks.com/index.pl?node_id=331720" looks especially as if the last few digits of the floating point literals in the code were ignored. That last report was on a winnt machine, but it's also said that it doesn't work on solaris. Please tell me on what platform and OS did you get the above results. ambrus