From 3c32996351d062b891c7cfbfe6a7ce5c63bd2fc8 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 17 Apr 1998 23:36:34 +0000 Subject: [PATCH] (read1): Compute NaN and infinities using 0.0 in a variable, to cope with compilers that think they are smarter than us. --- src/lread.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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); } -- 2.39.2