aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Schwab2007-11-16 00:10:00 +0000
committerAndreas Schwab2007-11-16 00:10:00 +0000
commit8875d2c00e62b6cef44e2ca19627427103512dd9 (patch)
tree192e5445f632437c2221027812f2eea3944ba4f7 /src
parent6e1ada1b21fca8307a6d363d672b1ac7ac32ea4c (diff)
downloademacs-8875d2c00e62b6cef44e2ca19627427103512dd9.tar.gz
emacs-8875d2c00e62b6cef44e2ca19627427103512dd9.zip
(Fformat): When formatting an integer as float take precision into account.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog1
-rw-r--r--src/editfns.c9
2 files changed, 8 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 6c22f16b189..3a74e58061e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,7 @@
12007-11-15 Andreas Schwab <schwab@suse.de> 12007-11-15 Andreas Schwab <schwab@suse.de>
2 2
3 * editfns.c (Fformat): Correctly format EMACS_INT values. 3 * editfns.c (Fformat): Correctly format EMACS_INT values.
4 When formatting an integer as float take precision into account.
4 5
5 * keyboard.c (Fevent_symbol_parse_modifiers): Fix declaration. 6 * keyboard.c (Fevent_symbol_parse_modifiers): Fix declaration.
6 7
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) */)
3594 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */ 3594 /* Would get MPV otherwise, since Lisp_Int's `point' to low memory. */
3595 else if (INTEGERP (args[n]) && *format != 's') 3595 else if (INTEGERP (args[n]) && *format != 's')
3596 { 3596 {
3597 thissize = 30;
3598
3597 /* The following loop assumes the Lisp type indicates 3599 /* The following loop assumes the Lisp type indicates
3598 the proper way to pass the argument. 3600 the proper way to pass the argument.
3599 So make sure we have a flonum if the argument should 3601 So make sure we have a flonum if the argument should
3600 be a double. */ 3602 be a double. */
3601 if (*format == 'e' || *format == 'f' || *format == 'g') 3603 if (*format == 'e' || *format == 'f' || *format == 'g')
3602 args[n] = Ffloat (args[n]); 3604 {
3605 args[n] = Ffloat (args[n]);
3606 if (precision[n] > 0)
3607 thissize += precision[n];
3608 }
3603 else 3609 else
3604 if (*format != 'd' && *format != 'o' && *format != 'x' 3610 if (*format != 'd' && *format != 'o' && *format != 'x'
3605 && *format != 'i' && *format != 'X' && *format != 'c') 3611 && *format != 'i' && *format != 'X' && *format != 'c')
3606 error ("Invalid format operation %%%c", *format); 3612 error ("Invalid format operation %%%c", *format);
3607 3613
3608 thissize = 30;
3609 if (*format == 'c') 3614 if (*format == 'c')
3610 { 3615 {
3611 if (! SINGLE_BYTE_CHAR_P (XINT (args[n])) 3616 if (! SINGLE_BYTE_CHAR_P (XINT (args[n]))