]> git.eshelyaron.com Git - emacs.git/commit
(format "%d" F) now truncates floating F
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 Jun 2018 19:21:40 +0000 (12:21 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 Jun 2018 19:23:08 +0000 (12:23 -0700)
commitd0e2a341dd9a9a365fd311748df024ecb25b70ec
treeaa5b4e9f33777155349c3aacefece4d25199b887
parent27a21970f6faa9baf42823f731b7842b075e86eb
(format "%d" F) now truncates floating F

Problem reported by Paul Pogonyshev (Bug#31938).
* src/editfns.c: Include math.h, for trunc.
(styled_format): For %d, truncate floating-point numbers and
convert -0 to 0, going back to how Emacs 26 did things.
* doc/lispref/strings.texi (Formatting Strings):
Document behavior of %o, %d, %x, %X on floating-point numbers.
* src/floatfns.c (trunc) [!HAVE_TRUNC]: Rename from emacs_trunc
and make it an extern function, so that editfns.c can use it.
All callers changed.
* test/src/editfns-tests.el (format-%d-float): New test.
doc/lispref/strings.texi
src/editfns.c
src/floatfns.c
src/lisp.h
test/src/editfns-tests.el