# HG changeset patch # User Andreas Schwab # Date 1195171822 0 # Node ID 8026a4be9d9cfc2c9e14a0657b55d455a09659be # Parent c83ab4ee6f0f2d8baeecc4fbd63cdb172f742a77 (Fformat): When formatting an integer as float take precision into account. diff -r c83ab4ee6f0f -r 8026a4be9d9c src/editfns.c --- a/src/editfns.c Thu Nov 15 23:53:10 2007 +0000 +++ b/src/editfns.c Fri Nov 16 00:10:22 2007 +0000 @@ -3596,18 +3596,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]))