1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-15 09:47:20 +00:00

(Fformat): When formatting an integer as float take precision into account.

This commit is contained in:
Andreas Schwab 2007-11-16 00:10:00 +00:00
parent 6e1ada1b21
commit 8875d2c00e
2 changed files with 8 additions and 2 deletions

View 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.
* keyboard.c (Fevent_symbol_parse_modifiers): Fix declaration.

View File

@ -3594,18 +3594,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]))