Fix use of dtoastr from gnulib.
authorMichael Welsh Duggan <md5i@md5i.com>
Mon, 14 Feb 2011 22:25:29 +0000 (17:25 -0500)
committerChong Yidong <cyd@stupidchicken.com>
Mon, 14 Feb 2011 22:25:29 +0000 (17:25 -0500)
* src/print.c (float_to_string): Ensure that a decimal point is
printed if using dtoastr (Bug#8033).

src/ChangeLog
src/print.c

index 2f57492..e3a3137 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-14  Michael Welsh Duggan  <md5i@md5i.com>
+
+       * print.c (float_to_string): Ensure that a decimal point is
+       printed if using dtoastr (Bug#8033).
+
 2011-02-14  Eli Zaretskii  <eliz@gnu.org>
 
        * msdos.c (IT_frame_up_to_date): 
index b5b278b..beb14a8 100644 (file)
@@ -1062,7 +1062,10 @@ float_to_string (char *buf, double data)
     {
       /* Generate the fewest number of digits that represent the
         floating point value without losing information.  */
-      dtoastr (buf, FLOAT_TO_STRING_BUFSIZE, 0, 0, data);
+      dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
+      /* The decimal point must be printed, or the byte compiler can
+        get confused (Bug#8033). */
+      width = 1;
     }
   else                 /* oink oink */
     {
@@ -1117,8 +1120,7 @@ float_to_string (char *buf, double data)
          cp[1] = '0';
          cp[2] = 0;
        }
-
-      if (*cp == 0)
+      else if (*cp == 0)
        {
          *cp++ = '.';
          *cp++ = '0';