fixed float constants to be read as doubles
This commit is contained in:
4
lex.ll
4
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;
|
||||
}
|
||||
|
||||
|
||||
6
parse.yy
6
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);
|
||||
|
||||
Reference in New Issue
Block a user