diff options
author | Richard M. Stallman <rms@gnu.org> | 2005-06-25 04:31:49 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2005-06-25 04:31:49 +0000 |
commit | 7690cbb0f9d9f7bb56edd67c06a89f116dd4f80d (patch) | |
tree | d53d730674e6ade81f22df362d98b1c4ca265ce1 /src | |
parent | cf4444417306114481ad8e86f47dcce13a589d42 (diff) | |
download | emacs-7690cbb0f9d9f7bb56edd67c06a89f116dd4f80d.tar.gz |
(read1): 0.0e+NaN should make a "positive" NaN.
Diffstat (limited to 'src')
-rw-r--r-- | src/lread.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c index 9317933013e..ccc94c32dd1 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2595,6 +2595,23 @@ read1 (readcharfun, pch, first_in_list) break; case 'N': value = zero / zero; + + /* If that made a "negative" NaN, negate it. */ + + { + int i; + union { double d; char c[sizeof (double)]; } u_data, u_minus_zero; + + u_data.d = value; + u_minus_zero.d = - 0.0; + for (i = 0; i < sizeof (double); i++) + if (u_data.c[i] & u_minus_zero.c[i]) + { + value = - value; + break; + } + } + /* Now VALUE is a positive NaN. */ break; default: value = atof (read_buffer + negative); |