summaryrefslogtreecommitdiff
path: root/src/editfns.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2007-11-16 00:10:22 +0000
committerAndreas Schwab <schwab@suse.de>2007-11-16 00:10:22 +0000
commitc659311efd0c2ae04c96b548863e1ad34f8fceaf (patch)
tree83ee6a66eee8970743509d576a7cd52f8314bfb2 /src/editfns.c
parent7ca976d6c1c6d1c2d30b3677cf8c8ebf69128d83 (diff)
downloademacs-c659311efd0c2ae04c96b548863e1ad34f8fceaf.tar.gz
(Fformat): When formatting an integer as float take precision into account.
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/editfns.c b/src/editfns.c
index deb95198978..c4b8aa073d3 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -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]))