bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31938: regression in (format "%d" -0.0)


From: Paul Pogonyshev
Subject: bug#31938: regression in (format "%d" -0.0)
Date: Fri, 22 Jun 2018 20:01:59 +0200

Severity: serious

Emacs 24-26:

    (format "%d" -0.0) => "0"

Emacs 27:

    (format "%d" -0.0) => "-0"

I think this is a very important regression, because it happens in
very low-level code and can lead to unpredictable results in certain
special cases. Caught with real-world `datetime' package: on Emacs 27
all its regression tests fail because of this change, on Emacs 24-26
they pass.

In the library, -0.0 comes from the fact that `mod' built-in can
return it as a result (it is probably fine, because it is _equal_ to
0.0, so it is not negative, even if it looks like it).

I.e. real code looks more like this:

    (let ((x -2.0)) (format "%d" (mod x 2)))

which gives "-0" and is a regression in Emacs 27.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]