diff options
author | Andreas Schwab <schwab@suse.de> | 2007-11-16 00:09:47 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2007-11-16 00:09:47 +0000 |
commit | dfc649c87218cbdaf5114530ccbff84f12911ae4 (patch) | |
tree | 254d3031717f4c0a27cd5a1d4d0f7f5d71577f8d /src/editfns.c | |
parent | 0f5081aabce6381a6baa9439a0af1cdada823150 (diff) | |
download | emacs-dfc649c87218cbdaf5114530ccbff84f12911ae4.tar.gz |
(Fformat): When formatting an integer as float take precision into account.
Diffstat (limited to 'src/editfns.c')
-rw-r--r-- | src/editfns.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c index f049aa67c30..eaee2bfadfa 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -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])) |