]> git.eshelyaron.com Git - emacs.git/commitdiff
(Fformat): When formatting an integer as float take precision into account.
authorAndreas Schwab <schwab@suse.de>
Fri, 16 Nov 2007 00:10:45 +0000 (00:10 +0000)
committerAndreas Schwab <schwab@suse.de>
Fri, 16 Nov 2007 00:10:45 +0000 (00:10 +0000)
src/ChangeLog
src/editfns.c

index c6c2db23f12cf29ef912956b29652da0472e4a9b..96b0d5f5e3f77ecfcfb27156abf0a306f6c71f60 100644 (file)
@@ -1,6 +1,7 @@
 2007-11-15  Andreas Schwab  <schwab@suse.de>
 
        * editfns.c (Fformat): Correctly format EMACS_INT values.
+       When formatting an integer as float take precision into account.
 
 2007-11-15  Juanma Barranquero  <lekktu@gmail.com>
 
index deb9519897808e69cb55af3b4f6eecaaaaa9e2d6..c4b8aa073d357507ada04864ba31b5a1caa862b2 100644 (file)
@@ -3596,18 +3596,23 @@ usage: (format STRING &rest OBJECTS)  */)
        /* Would get MPV otherwise, since Lisp_Int's `point' to low memory.  */
        else if (INTEGERP (args[n]) && *format != 's')
          {
+           thissize = 30;
+
            /* The following loop assumes the Lisp type indicates
               the proper way to pass the argument.
               So make sure we have a flonum if the argument should
               be a double.  */
            if (*format == 'e' || *format == 'f' || *format == 'g')
-             args[n] = Ffloat (args[n]);
+             {
+               args[n] = Ffloat (args[n]);
+               if (precision[n] > 0)
+                 thissize += precision[n];
+             }
            else
              if (*format != 'd' && *format != 'o' && *format != 'x'
                  && *format != 'i' && *format != 'X' && *format != 'c')
                error ("Invalid format operation %%%c", *format);
 
-           thissize = 30;
            if (*format == 'c')
              {
                if (! SINGLE_BYTE_CHAR_P (XINT (args[n]))