GNU bug report logs - #5916
XFLOAT_DATA and signed zeroes

Previous Next

Package: emacs;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Fri, 9 Apr 2010 23:54:02 UTC

Severity: normal

Done: Ken Raeburn <raeburn <at> raeburn.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5916 in the body.
You can then email your comments to 5916 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Fri, 09 Apr 2010 23:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Vincent Lefevre <vincent <at> vinc17.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 09 Apr 2010 23:54:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-gnu-emacs <at> gnu.org
Subject: XFLOAT_DATA and signed zeroes
Date: Sat, 10 Apr 2010 01:39:23 +0200
Hi,

I don't know whether there's really a bug (I haven't tested the
trunk), but someone pointed a suspicious macro[*]. The change
(on 2009-08-17) is here:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6f0c16bc45815337d520a9393f8de5f9c14a06d4

It is said:

  lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.

However, adding 0 has another side effect on floats: the 0 is
converted into +0.0 (due to the addition with a double), so that
a -0.0 is transformed into a +0.0.

Could someone try the following?

  (/ 1.0 (- 0.0))

The correct result should be -1.0e+INF (negative infinity).

[*] http://groupes.codes-sources.com/article-emacs-lisp-sera-iee754-fut-0x-p0-toujours-470516.aspx

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sat, 10 Apr 2010 15:21:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 5916 <at> debbugs.gnu.org
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sat, 10 Apr 2010 11:20:33 -0400
>   lisp.h (XFLOAT_DATA): Produce an rvalue by adding 0 to the value.

> However, adding 0 has another side effect on floats: the 0 is
> converted into +0.0 (due to the addition with a double), so that
> a -0.0 is transformed into a +0.0.

I guess we could/should make this "+0" conditional on some debugging
option, since after all it's only needed to catch coding errors.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sat, 10 Apr 2010 16:06:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 5916 <at> debbugs.gnu.org, Vincent Lefevre <vincent <at> vinc17.net>
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sat, 10 Apr 2010 18:05:24 +0200
You can also use the unary + to create an rvalue.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sat, 10 Apr 2010 16:44:02 GMT) Full text and rfc822 format available.

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

From: Vincent Lefevre <vincent <at> vinc17.net>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 5916 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sat, 10 Apr 2010 18:43:13 +0200
On 2010-04-10 18:05:24 +0200, Andreas Schwab wrote:
> You can also use the unary + to create an rvalue.

MPFR uses:

#define MPFR_VALUE_OF(x)  (0 ? (x) : (x))

It was suggested by Wojtek Lerch and Tim Rentsch in comp.std.c.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sat, 10 Apr 2010 17:26:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Vincent Lefevre <vincent <at> vinc17.net>
Cc: 5916 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sat, 10 Apr 2010 19:25:54 +0200
Vincent Lefevre <vincent <at> vinc17.net> writes:

> MPFR uses:
>
> #define MPFR_VALUE_OF(x)  (0 ? (x) : (x))

You need that if you want to handle more than just arithmetic types.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sun, 16 May 2010 18:59:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: raeburn <at> raeburn.org
Cc: 5916 <at> debbugs.gnu.org
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sun, 16 May 2010 14:58:37 -0400
> revno: 100306 [merge]
> committer: Ken Raeburn <raeburn <at> raeburn.org>
> branch nick: trunk
> timestamp: Sat 2010-05-15 17:21:30 -0400
[...]
>   * src/lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue. (bug#5916)
>   (LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise.


So can this bug be closed now?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#5916; Package emacs. (Sun, 16 May 2010 22:36:02 GMT) Full text and rfc822 format available.

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

From: Ken Raeburn <raeburn <at> raeburn.org>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 5916 <at> debbugs.gnu.org
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sun, 16 May 2010 16:11:25 -0400
On May 16, 2010, at 14:58, Glenn Morris wrote:
> So can this bug be closed now?

Ah, yes... sorry, I forgot about that.  Thanks for the reminder.
Looking up how to do that now....

Ken




Reply sent to Ken Raeburn <raeburn <at> raeburn.org>:
You have taken responsibility. (Sun, 16 May 2010 22:36:03 GMT) Full text and rfc822 format available.

Notification sent to Vincent Lefevre <vincent <at> vinc17.net>:
bug acknowledged by developer. (Sun, 16 May 2010 22:36:03 GMT) Full text and rfc822 format available.

Message #28 received at 5916-done <at> debbugs.gnu.org (full text, mbox):

From: Ken Raeburn <raeburn <at> raeburn.org>
To: 5916-done <at> debbugs.gnu.org
Subject: Re: bug#5916: XFLOAT_DATA and signed zeroes
Date: Sun, 16 May 2010 16:12:31 -0400
Should be fixed on trunk by yesterday's checkin:

>> revno: 100306 [merge]
>> committer: Ken Raeburn <raeburn <at> raeburn.org>
>> branch nick: trunk
>> timestamp: Sat 2010-05-15 17:21:30 -0400
> [...]
>>  * src/lisp.h (XFLOAT_DATA): Use "0?x:x" to generate an rvalue. (bug#5916)
>>  (LISP_MAKE_RVALUE) [!USE_LISP_UNION_TYPE && !__GNUC__]: Likewise.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 14 Jun 2010 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 13 days ago.

Previous Next


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