Merge pull request #7787 from SaracenOne/nan_and_inf

Inf and NaN support added to GDScript
This commit is contained in:
Rémi Verschelde
2017-02-28 23:00:30 +01:00
committed by GitHub
3 changed files with 14 additions and 2 deletions

View File

@@ -558,6 +558,12 @@ Error VisualScriptExpression::_get_token(Token& r_token) {
} else if (id=="PI") {
r_token.type=TK_CONSTANT;
r_token.value=Math_PI;
} else if (id == "INF") {
r_token.type = TK_CONSTANT;
r_token.value = Math_INF;
} else if (id == "NAN") {
r_token.type = TK_CONSTANT;
r_token.value = Math_NAN;
} else if (id=="not") {
r_token.type=TK_OP_NOT;
} else if (id=="or") {

View File

@@ -1738,6 +1738,8 @@ const char* VisualScriptMathConstant::const_name[MATH_CONSTANT_MAX]={
"PI/2",
"E",
"Sqrt2",
"INF",
"NAN"
};
double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX]={
@@ -1746,7 +1748,9 @@ double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX]={
Math_PI*2,
Math_PI*0.5,
2.71828182845904523536,
Math::sqrt(2.0)
Math::sqrt(2.0),
Math_INF,
Math_NAN
};

View File

@@ -467,7 +467,9 @@ public:
MATH_CONSTANT_HALF_PI,
MATH_CONSTANT_E,
MATH_CONSTANT_SQRT2,
MATH_CONSTANT_MAX,
MATH_CONSTANT_INF,
MATH_CONSTANT_NAN,
MATH_CONSTANT_MAX
};
private: