aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editfns.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 8e0c0c451e6..1b33f397110 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3594,6 +3594,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3594 sprintf_bytes = prec != 0; 3594 sprintf_bytes = prec != 0;
3595 } 3595 }
3596 else if (BIGNUMP (arg)) 3596 else if (BIGNUMP (arg))
3597 bignum_arg:
3597 { 3598 {
3598 int base = ((conversion == 'd' || conversion == 'i') ? 10 3599 int base = ((conversion == 'd' || conversion == 'i') ? 10
3599 : conversion == 'o' ? 8 : 16); 3600 : conversion == 'o' ? 8 : 16);
@@ -3655,11 +3656,17 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
3655 else 3656 else
3656 { 3657 {
3657 double d = XFLOAT_DATA (arg); 3658 double d = XFLOAT_DATA (arg);
3658 double uintmax = UINTMAX_MAX; 3659 double abs_d = fabs (d);
3659 if (! (0 <= d && d < uintmax + 1)) 3660 if (abs_d < UINTMAX_MAX + 1.0)
3660 xsignal1 (Qoverflow_error, arg); 3661 {
3661 x = d; 3662 negative = d <= -1;
3662 negative = false; 3663 x = abs_d;
3664 }
3665 else
3666 {
3667 arg = double_to_integer (d);
3668 goto bignum_arg;
3669 }
3663 } 3670 }
3664 p[0] = negative ? '-' : plus_flag ? '+' : ' '; 3671 p[0] = negative ? '-' : plus_flag ? '+' : ' ';
3665 bool signedp = negative | plus_flag | space_flag; 3672 bool signedp = negative | plus_flag | space_flag;