emacs-devel
[Top][All Lists]
Advanced

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

Re: Using the GNU GMP Library for Bignums in Emacs


From: Paul Eggert
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Wed, 1 Aug 2018 00:57:09 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On July 22 I wrote:

I see three ways to go here.

1. We change eql, memql, sxhash-eql, etc. to treat all NaNs alike, so that there is just one NaN value from the Lisp point of view. We also change 'format', 'copysign' etc. to ignore a NaN's sign, and look through any other use of floating-point values to make sure that NaN signs are ignored.

2. We change eql, memql, sxhash-eql, etc. so that only the sign (not the significand) of a NaN is looked at, so that there are just two NaN values from the Lisp point of view.

3. We alter 'read', 'format' etc. to read and generate NaN significands. For example, (format "%s" NaN) could return "0.1e+NaN" if the significand's low-order bit was set.

(1) sounds too drastic, as the sign of a NaN can be useful in some cases and Emacs has long provided for obtaining the sign of a NaN. Although either (2) or (3) would be OK, I'm inclined to go for (3) as I expect it would be a bit cleaner and more useful.


No further comment on this, and I went with (3) and installed into master the attached patch to do something along those lines on platforms that have ieee754.h (mostly GNUish platforms, I expect). Other platforms are unaffected.

Attachment: 0001-Read-and-print-NaN-significand-if-ieee754.h.patch
Description: Text Data


reply via email to

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