GNU bug report logs - #42597
27.1; (+ -0.0) returns +0.0 when compiled

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Wed, 29 Jul 2020 12:41:01 UTC

Severity: normal

Tags: patch

Found in version 27.1

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 42597 <at> debbugs.gnu.org (full text, mbox):

From: Mattias Engdegård <mattiase <at> acm.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 42597 <at> debbugs.co.uk
Subject: Re: bug#42597: 27.1; (+ -0.0) returns +0.0 when compiled
Date: Mon, 3 Aug 2020 17:36:03 +0200
[Message part 1 (text/plain, inline)]
29 juli 2020 kl. 15.35 skrev Alan Mackenzie <acm <at> muc.de>:

> This is an example of what happens when ignorant people rule the roost.
> -0.0 and +0.0 are identically the same thing.  It should not take a
> degree in mathematics (which I have) to realise this.  When you put
> mathematical nonsense into <whatever thing is producing -0.0> you cannot
> help but get nonsense back out.

Thanks Alan -- there are good arguments both for and against negative zero and I would happily discuss them over a little glass of something once it is possible to meet in person again. Now we don't have much choice since IEEE-754 is what it is and we should have very strong reasons for making changes that conflict with that standard.

At the very least we should be consistent. The effort is small enough (first patch below, I went with the (* x 1) variant).

The code did contain a fair amount of obsolete and/or incorrect comments and decisions, some relating to bug#1334 which is no longer relevant (Emacs didn't have bignums at the time). Today, the N-arg semantics of +, - (except for N=1), *, min and max (but notably not /) are equivalent to the corresponding left-folds of binary operations, which helps a lot. The second patch cleans up and improves optimisation for arithmetic operations generally.

[0001-Fix-byte-compilation-of-0.0-bug-42597.patch (application/octet-stream, attachment)]
[0002-Clean-up-and-improve-compilation-of-arithmetic-opera.patch (application/octet-stream, attachment)]

This bug report was last modified 4 years and 287 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.