aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/editfns.c')
-rw-r--r--src/editfns.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 30d585cd018..7d032a7ca4c 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -47,6 +47,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
47#include <errno.h> 47#include <errno.h>
48#include <float.h> 48#include <float.h>
49#include <limits.h> 49#include <limits.h>
50#include <math.h>
50 51
51#ifdef HAVE_TIMEZONE_T 52#ifdef HAVE_TIMEZONE_T
52# include <sys/param.h> 53# include <sys/param.h>
@@ -4671,6 +4672,12 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool message)
4671 { 4672 {
4672 strcpy (f - pMlen - 1, "f"); 4673 strcpy (f - pMlen - 1, "f");
4673 double x = XFLOAT_DATA (arg); 4674 double x = XFLOAT_DATA (arg);
4675
4676 /* Truncate and then convert -0 to 0, to be more
4677 consistent with %x etc.; see Bug#31938. */
4678 x = trunc (x);
4679 x = x ? x : 0;
4680
4674 sprintf_bytes = sprintf (sprintf_buf, convspec, 0, x); 4681 sprintf_bytes = sprintf (sprintf_buf, convspec, 0, x);
4675 char c0 = sprintf_buf[0]; 4682 char c0 = sprintf_buf[0];
4676 bool signedp = ! ('0' <= c0 && c0 <= '9'); 4683 bool signedp = ! ('0' <= c0 && c0 <= '9');