diff --git a/src/lex.c b/src/lex.c
index 1e60f725390027173191398de1142814db7839fd..d5dca0f5ff50059b96f891ee0170275bccec9f32 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: lex.c,v 1.22 1997/05/13 15:49:54 grubba Exp $");
+RCSID("$Id: lex.c,v 1.23 1997/05/19 09:32:39 hubbe Exp $");
 #include "language.h"
 #include "array.h"
 #include "lex.h"
@@ -1478,8 +1478,11 @@ static int do_lex2(int literal, YYSTYPE *yylval)
     case '5': case '6': case '7': case '8': case '9':
     {
       char *p, *p2;
+      int isfloat=0;
+      double d;
+
       UNGETC(c);
-      READBUF(isdigit(C) || C=='.' || C=='e' || C=='E');
+      READBUF(isdigit(C) || C=='.');
 
       p=STRCHR(buf,'.');
       
@@ -1495,25 +1498,38 @@ static int do_lex2(int literal, YYSTYPE *yylval)
 	  UNGETSTR(p,strlen(p));
 	  *p=0;
 	}
+
 	if((p=STRCHR(buf,'.')))
 	{
-	  yylval->fnum=STRTOD(buf,NULL);
-	  return F_FLOAT;
+	  isfloat=1;
 	}
       }
-      p = STRCHR(buf, 'e');
-      p2 = STRCHR(buf, 'E');
-      if (p || p2) {
-	if (p) {
-	  if (p2 && (p > p2)) {
-	    p = p2;
-	  }
-	} else {
-	  p = p2;
-	}
-	UNGETSTR(p, strlen(p));
-	*p = 0;
+
+      d=STRTOD(buf, NULL);
+
+      if(GOBBLE('e') || GOBBLE('E'))
+      {
+	int neg;
+	if(GOBBLE('-'))
+	  neg=1;
+	else if(GOBBLE('+'))
+	  neg=0;
+	else
+	  neg=0;
+	
+	READBUF(isdigit(C));
+        if(neg)
+	  d /= pow(10.0,STRTOD(buf,NULL));
+        else
+	  d *= pow(10.0,STRTOD(buf,NULL));
+	isfloat=1;
       }
+      if(isfloat)
+      {
+	yylval->fnum=(float)d;
+	return F_FLOAT;
+      }
+
       if(buf[0]=='0')
 	yylval->number=STRTOL(buf,NULL,8);
       else
diff --git a/src/testsuite.in b/src/testsuite.in
index 6ddc9a4898adceef9f05802cf44161281c548c9f..435d41e45e7dc9a362becc3802c1122e0a9e740f 100644
--- a/src/testsuite.in
+++ b/src/testsuite.in
@@ -1,4 +1,9 @@
-test_true([["$Id: testsuite.in,v 1.40 1997/04/28 23:48:42 hubbe Exp $"]])
+test_true([["$Id: testsuite.in,v 1.41 1997/05/19 09:32:40 hubbe Exp $"]])
+test_eq(1e1,10.0)
+test_eq(1E1,10.0)
+test_eq(1e+1,10.0)
+test_eq(1.1e1,11.0)
+test_eq(1e-1,0.1)
 test_any([[class foo { constant x=17; }; class bar { inherit foo; constant x=18; }; return bar()->x;]],18)
 test_program([[inline string foo(string s){ while(s[0] == ' ' || s[0] == '\t') s = s[1..]; return(s); } string a() { return foo("   bar"); }]])
 test_true([[lambda(function f) {return 1;}(object_program(this_object()));]])