On Thu, Apr 22, 2004 at 02:48:18AM +0900, Gavin Kistner wrote:
> irb(main):001:0> 5.00000000000007.to_s
> => "5.00000000000007"
> 
> irb(main):002:0> 5.000000000000007.to_s
> => "5.00000000000001"
> 
> irb(main):003:0> 5.0000000000000007.to_s
> => "5"
> 
> irb(main):004:0> 5.00000000000000007.to_s
> => "5.0"
> 
> Note the weirdness in the third item, as reported by 'quix' on the 
> #ruby-lang IRC channel.
> 
> (The issue is not the lack of float precision...that's gotta give out 
> at some point. The issue is the "5" vs. "5.0" discrepancy.)

Try this patch:

--- numeric.c.orig	2004-04-21 04:31:04.000000000 +0300
+++ numeric.c	2004-04-21 04:31:08.000000000 +0300
@@ -490,10 +490,10 @@
     VALUE flt;
 {
     char buf[32];
-    char *fmt = "%.15g";
+    char *fmt = "%.15f";
     double value = RFLOAT(flt)->value;
     double avalue, d1, d2;
-
+    
     if (isinf(value))
 	return rb_str_new2(value < 0 ? "-Infinity" : "Infinity");
     else if(isnan(value))


-- 
University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky