MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Patch for floating-point literal bug in 1.8.0beta1



HPA has pointed out a serious bug in 1.8.0beta1's parsing of floating-point
literals.  You should make the patch he suggests.

------- Forwarded Message

Date: Thu, 08 Feb 1996 23:15:25 -0800
From: hpa@storm.net (H. Peter Anvin)

The following patch fixes a bug in 1.8.0beta1 parser.y, which would
cause floating point constants with an exponent but no decimal point
to be misrecognized as integers.  This is particularly evil since it
would affect code after the fact: if entered as 1.0e+47 it would be
FLOAT until the db was dumped and restored (written out at 1e+47) then
read in as an integer: 1.

--- parser.y.beta1	Thu Feb  8 23:09:19 1996
+++ parser.y	Thu Feb  8 23:11:03 1996
@@ -844,6 +844,7 @@
 	}
 
 	if (c == 'e' || c == 'E') { /* better be an exponent */
+	    type = tFLOAT;
 	    stream_add_char(token_stream, c);
 	    c = lex_getc();
 	    if (c == '+' || c == '-') {

------- End of Forwarded Message




Home | Subject Index | Thread Index