Mercurial > emacs
changeset 63755:36bd1972ba30
(read1): 0.0e+NaN should make a "positive" NaN.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 25 Jun 2005 04:31:49 +0000 |
parents | 077498a3a319 |
children | c1c472b86d74 |
files | src/lread.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lread.c Sat Jun 25 02:31:45 2005 +0000 +++ b/src/lread.c Sat Jun 25 04:31:49 2005 +0000 @@ -2595,6 +2595,23 @@ 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);