# HG changeset patch # User Andreas Schwab # Date 1195171787 0 # Node ID 5c30362455bfe65b3bdc789c705788a80285f623 # Parent fe9b5d62e0afd4217ed4eb87a6be43af7268011e (Fformat): When formatting an integer as float take precision into account. diff -r fe9b5d62e0af -r 5c30362455bf src/editfns.c --- a/src/editfns.c Thu Nov 15 23:52:51 2007 +0000 +++ b/src/editfns.c Fri Nov 16 00:09:47 2007 +0000 @@ -3594,18 +3594,23 @@ /* 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]))