diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-07-13 14:26:29 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-07-13 14:43:03 -0700 |
commit | 0cd519971d199836ba0a6e9f0e36af9b9accaf0d (patch) | |
tree | adf49dde9f863b4e1ce00a9c37dfd1a761a98a7a /src/data.c | |
parent | b94e7e6334718061879c32025941f00913078230 (diff) |
Port NaN, infinity handling better to VAX
Nowadays .elc files routinely contain tokens like 1.0e+INF and
0.0e+NaN that do not work on antiques like the VAX that lack IEEE fp.
Port Emacs to these platforms, by treating infinities as extreme
values and NaNs as strings that trap if used numerically.
* src/lread.c (INFINITY): Default to HUGE_VAL if non-IEEE.
(not_a_number) [!IEEE_FLOATING_POINT]: New static array.
(syms_of_lread) [!IEEE_FLOATING_POINT]: Initialize it.
(read0): Report invalid syntax for +0.0e+NaN on platforms
that lack NaNs.
(string_to_number): On non-IEEE platforms, return HUGE_VAL
for infinity and a string for NaN. All callers changed.
Diffstat (limited to 'src/data.c')
-rw-r--r-- | src/data.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/data.c b/src/data.c index 6de8e0cf1a1..5a31462d8ca 100644 --- a/src/data.c +++ b/src/data.c @@ -3033,7 +3033,8 @@ If the base used is not 10, STRING is always parsed as an integer. */) p++; Lisp_Object val = string_to_number (p, b, 0); - return NILP (val) ? make_fixnum (0) : val; + return ((IEEE_FLOATING_POINT ? NILP (val) : !NUMBERP (val)) + ? make_fixnum (0) : val); } enum arithop |