diff src/lread.c @ 2010:a9cdbfb4716e

[xemacs-hg @ 2004-04-13 15:38:30 by james] Handle leading + signs on numbers correctly.
author james
date Tue, 13 Apr 2004 15:38:42 +0000
parents 4e6a63799f08
children f2fdfc131770
line wrap: on
line diff
--- a/src/lread.c	Tue Apr 13 04:23:50 2004 +0000
+++ b/src/lread.c	Tue Apr 13 15:38:42 2004 +0000
@@ -1851,6 +1851,9 @@
 #ifdef HAVE_RATIO
       if (isratio_string (read_ptr))
 	{
+	  /* GMP ratio_set_string returns random values with initial + sign */
+	  if (*read_ptr == '+')
+	    read_ptr++;
 	  ratio_set_string (scratch_ratio, read_ptr, 0);
 	  ratio_canonicalize (scratch_ratio);
 	  return Fcanonicalize_number (make_ratio_rt (scratch_ratio));
@@ -2673,8 +2676,8 @@
 int
 isratio_string (const char *cp)
 {
-  /* Possible minus sign */
-  if (*cp == '-')
+  /* Possible minus/plus sign */
+  if (*cp == '-' || *cp == '+')
     cp++;
 
   /* Numerator */