山本です。

nobu.nakada / nifty.ne.jp wrote:
(2004/07/04 14:56)

>strncasecmp()を使って下さい。また、除数も 0.0 にしないとgccが警
>告を出します。

わかりました、そうします。

Index: util.c
===================================================================
RCS file: /var/cvs/src/ruby/util.c,v
retrieving revision 1.43
diff -u -w -b -p -r1.43 util.c
--- util.c	14 May 2004 03:17:29 -0000	1.43
+++ util.c	4 Jul 2004 06:11:56 -0000
@@ -750,6 +750,7 @@ ruby_strtod(string, endPtr)
 				 * in string. */
     const char *pExp;		/* Temporarily holds location of exponent
 				 * in string. */
+    int frac1, frac2;
 
     /*
      * Strip off leading blanks and check for a sign.
@@ -772,6 +773,22 @@ ruby_strtod(string, endPtr)
     }
 
     /*
+     * Check for NaN and Inf.
+     */
+
+    if (strncasecmp(p, "NaN", 3) == 0) {
+	p += 3;
+	fraction = 0.0 / 0.0;
+	goto exit;
+    }
+
+    if (strncasecmp(p, "Inf", 3) == 0) {
+	p += 3;
+	fraction = 1.0 / 0.0;
+	goto exit;
+    }
+
+    /*
      * Count the number of digits in the mantissa
      * and also locate the decimal point.
      */
@@ -812,8 +829,7 @@ ruby_strtod(string, endPtr)
 	fracExp += (mantSize - 18);
 	mantSize = 18;
     }
-    {
-	int frac1, frac2;
+
 	frac1 = 0;
 	for ( ; mantSize > 9; mantSize -= 1) {
 	    c = *p;
@@ -920,12 +936,11 @@ ruby_strtod(string, endPtr)
 	else {
 	    fraction += frac2 * dblExp;
 	}
-    }
 
+  exit:
     if (endPtr != NULL) {
 	*endPtr = (char *) p;
     }
-
     if (sign) {
 	return -fraction;
     }