From: Mark Hubbart Date: 2004-05-06T07:31:29+09:00 Subject: Re: Bug in Float literal (1e-19 == 0) Re: 0.0 sign On May 5, 2004, at 3:13 PM, 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. For me, it cuts off after 1e-17: 0.000_000_000_000_000_01 ==>1e-17 0.000_000_000_000_000_001 ==>0.0 I'm not sure it's a bug in float parsing, since you can go: 1e-18 ==>1e-18 1e-300 ==>1e-300 ...which would be preferable to typing in all those zeros anyway. But I would be curious to know why they decided to truncate long float literals? --Mark