From 715b82826634644eec8f95f40e53d16b8a587ca3 Mon Sep 17 00:00:00 2001 From: egaburov Date: Fri, 13 Sep 2013 09:25:52 +0200 Subject: [PATCH] fixed float constants to be read as doubles --- lex.ll | 4 ++-- parse.yy | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lex.ll b/lex.ll index 8baa627a..129f0cd5 100644 --- a/lex.ll +++ b/lex.ll @@ -440,13 +440,13 @@ L?\"(\\.|[^\\"])*\" { lStringConst(&yylval, &yylloc); return TOKEN_STRING_LITERA {FLOAT_NUMBER} { RT; - yylval.floatVal = (float)atof(yytext); + yylval.floatVal = atof(yytext); return TOKEN_FLOAT_CONSTANT; } {HEX_FLOAT_NUMBER} { RT; - yylval.floatVal = (float)lParseHexFloat(yytext); + yylval.floatVal = lParseHexFloat(yytext); return TOKEN_FLOAT_CONSTANT; } diff --git a/parse.yy b/parse.yy index 9a2b4fc3..b55d49e0 100644 --- a/parse.yy +++ b/parse.yy @@ -149,7 +149,7 @@ struct ForeachDimension { %union { uint64_t intVal; - float floatVal; + double floatVal; std::string *stringVal; const char *constCharPtr; @@ -326,8 +326,8 @@ primary_expression (uint64_t)yylval.intVal, @1); } | TOKEN_FLOAT_CONSTANT { - $$ = new ConstExpr(AtomicType::UniformFloat->GetAsConstType(), - (float)yylval.floatVal, @1); + $$ = new ConstExpr(AtomicType::UniformDouble->GetAsConstType(), + yylval.floatVal, @1); } | TOKEN_TRUE { $$ = new ConstExpr(AtomicType::UniformBool->GetAsConstType(), true, @1);