fixed float constants to be read as doubles

This commit is contained in:
egaburov
2013-09-13 09:25:52 +02:00
parent 40af8d6ed5
commit 715b828266
2 changed files with 5 additions and 5 deletions

4
lex.ll
View File

@@ -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;
}

View File

@@ -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);