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} {
|
{FLOAT_NUMBER} {
|
||||||
RT;
|
RT;
|
||||||
yylval.floatVal = (float)atof(yytext);
|
yylval.floatVal = atof(yytext);
|
||||||
return TOKEN_FLOAT_CONSTANT;
|
return TOKEN_FLOAT_CONSTANT;
|
||||||
}
|
}
|
||||||
|
|
||||||
{HEX_FLOAT_NUMBER} {
|
{HEX_FLOAT_NUMBER} {
|
||||||
RT;
|
RT;
|
||||||
yylval.floatVal = (float)lParseHexFloat(yytext);
|
yylval.floatVal = lParseHexFloat(yytext);
|
||||||
return TOKEN_FLOAT_CONSTANT;
|
return TOKEN_FLOAT_CONSTANT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
parse.yy
6
parse.yy
@@ -149,7 +149,7 @@ struct ForeachDimension {
|
|||||||
|
|
||||||
%union {
|
%union {
|
||||||
uint64_t intVal;
|
uint64_t intVal;
|
||||||
float floatVal;
|
double floatVal;
|
||||||
std::string *stringVal;
|
std::string *stringVal;
|
||||||
const char *constCharPtr;
|
const char *constCharPtr;
|
||||||
|
|
||||||
@@ -326,8 +326,8 @@ primary_expression
|
|||||||
(uint64_t)yylval.intVal, @1);
|
(uint64_t)yylval.intVal, @1);
|
||||||
}
|
}
|
||||||
| TOKEN_FLOAT_CONSTANT {
|
| TOKEN_FLOAT_CONSTANT {
|
||||||
$$ = new ConstExpr(AtomicType::UniformFloat->GetAsConstType(),
|
$$ = new ConstExpr(AtomicType::UniformDouble->GetAsConstType(),
|
||||||
(float)yylval.floatVal, @1);
|
yylval.floatVal, @1);
|
||||||
}
|
}
|
||||||
| TOKEN_TRUE {
|
| TOKEN_TRUE {
|
||||||
$$ = new ConstExpr(AtomicType::UniformBool->GetAsConstType(), true, @1);
|
$$ = new ConstExpr(AtomicType::UniformBool->GetAsConstType(), true, @1);
|
||||||
|
|||||||
Reference in New Issue
Block a user