From: Richard M. Stallman Date: Fri, 17 Apr 1998 23:36:34 +0000 (+0000) Subject: (read1): Compute NaN and infinities using 0.0 in a X-Git-Tag: emacs-20.3~1439 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3c32996351d062b891c7cfbfe6a7ce5c63bd2fc8;p=emacs.git (read1): Compute NaN and infinities using 0.0 in a variable, to cope with compilers that think they are smarter than us. --- diff --git a/src/lread.c b/src/lread.c index 0d7238ddf35..3df769115f4 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1916,6 +1916,7 @@ read1 (readcharfun, pch, first_in_list) #ifdef LISP_FLOAT_TYPE if (isfloat_string (read_buffer)) { + double zero = 0.0; double value = atof (read_buffer); if (read_buffer[0] == '-' && value == 0.0) value *= -1.0; @@ -1924,11 +1925,11 @@ read1 (readcharfun, pch, first_in_list) if (p[-1] == 'F' || p[-1] == 'N') { if (p[-1] == 'N') - value = 0.0 / 0.0; + value = zero / zero; else if (read_buffer[0] == '-') - value = -1.0e999; + value = - 1.0 / zero; else - value = 1.0e999; + value = 1.0 / zero; } return make_float (value); }