diff options
| author | Paul Eggert | 2018-08-01 18:53:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-08-01 19:01:51 -0700 |
| commit | d216d7d248199aa6c99cd642116717c5b301ae6d (patch) | |
| tree | 687b9efadbb87fa1095fb0a2e0569e625856e15a /src/lread.c | |
| parent | 2f37ecaefcc61b0bf389f1c1eb3ac1b15105f056 (diff) | |
| download | emacs-d216d7d248199aa6c99cd642116717c5b301ae6d.tar.gz emacs-d216d7d248199aa6c99cd642116717c5b301ae6d.zip | |
Substitute a <ieee754.h> on hosts lacking it
* .gitignore: Add lib/ieee754.h.
* admin/merge-gnulib (GNULIB_MODULES): Add ieee754-h.
* configure.ac: Remove ieee754.h check, as Gnulib now does that.
* etc/NEWS: Mention this.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/ieee754.in.h, m4/ieee754-h.m4: New files, from Gnulib.
* src/lisp.h (IEEE_FLOATING_POINT): Now a macro so that it
can be used in #if.
* src/lread.c, src/print.c: Include <ieee754.h> if
IEEE_FLOATING_POINT, not if HAVE_IEEE754_H.
* src/lread.c (string_to_number):
* src/print.c (float_to_string):
Process NaNs only on IEEE hosts, and assume <ieee754.h>
in that case.
Diffstat (limited to 'src/lread.c')
| -rw-r--r-- | src/lread.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lread.c b/src/lread.c index 290b0f6bbe9..9a025d8664d 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -72,7 +72,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 72 | #define file_tell ftell | 72 | #define file_tell ftell |
| 73 | #endif | 73 | #endif |
| 74 | 74 | ||
| 75 | #if HAVE_IEEE754_H | 75 | #if IEEE_FLOATING_POINT |
| 76 | # include <ieee754.h> | 76 | # include <ieee754.h> |
| 77 | #endif | 77 | #endif |
| 78 | 78 | ||
| @@ -3756,21 +3756,18 @@ string_to_number (char const *string, int base, int flags) | |||
| 3756 | cp += 3; | 3756 | cp += 3; |
| 3757 | value = INFINITY; | 3757 | value = INFINITY; |
| 3758 | } | 3758 | } |
| 3759 | #if IEEE_FLOATING_POINT | ||
| 3759 | else if (cp[-1] == '+' | 3760 | else if (cp[-1] == '+' |
| 3760 | && cp[0] == 'N' && cp[1] == 'a' && cp[2] == 'N') | 3761 | && cp[0] == 'N' && cp[1] == 'a' && cp[2] == 'N') |
| 3761 | { | 3762 | { |
| 3762 | state |= E_EXP; | 3763 | state |= E_EXP; |
| 3763 | cp += 3; | 3764 | cp += 3; |
| 3764 | #if HAVE_IEEE754_H | ||
| 3765 | union ieee754_double u | 3765 | union ieee754_double u |
| 3766 | = { .ieee_nan = { .exponent = -1, .quiet_nan = 1, | 3766 | = { .ieee_nan = { .exponent = -1, .quiet_nan = 1, |
| 3767 | .mantissa0 = n >> 31 >> 1, .mantissa1 = n }}; | 3767 | .mantissa0 = n >> 31 >> 1, .mantissa1 = n }}; |
| 3768 | value = u.d; | 3768 | value = u.d; |
| 3769 | #else | ||
| 3770 | /* NAN is a "positive" NaN on all known Emacs hosts. */ | ||
| 3771 | value = NAN; | ||
| 3772 | #endif | ||
| 3773 | } | 3769 | } |
| 3770 | #endif | ||
| 3774 | else | 3771 | else |
| 3775 | cp = ecp; | 3772 | cp = ecp; |
| 3776 | } | 3773 | } |