Use the standard C INFINITY and NAN constants directly

The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.

Some portions of the code were already using `INFINITY` directly.
This commit is contained in:
Hugo Locurcio 2021-07-21 10:40:31 +02:00
parent 8cc599db64
commit 4bd5e4fd9b
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
14 changed files with 23 additions and 25 deletions

View file

@ -1637,8 +1637,8 @@ void GDScriptLanguage::init() {
_add_global(StaticCString::create("PI"), Math_PI);
_add_global(StaticCString::create("TAU"), Math_TAU);
_add_global(StaticCString::create("INF"), Math_INF);
_add_global(StaticCString::create("NAN"), Math_NAN);
_add_global(StaticCString::create("INF"), INFINITY);
_add_global(StaticCString::create("NAN"), NAN);
//populate native classes

View file

@ -457,12 +457,12 @@ void GDScriptLanguage::get_public_constants(List<Pair<String, Variant>> *p_const
Pair<String, Variant> infinity;
infinity.first = "INF";
infinity.second = Math_INF;
infinity.second = INFINITY;
p_constants->push_back(infinity);
Pair<String, Variant> nan;
nan.first = "NAN";
nan.second = Math_NAN;
nan.second = NAN;
p_constants->push_back(nan);
}

View file

@ -2123,10 +2123,10 @@ GDScriptParser::ExpressionNode *GDScriptParser::parse_builtin_constant(Expressio
constant->value = Math_TAU;
break;
case GDScriptTokenizer::Token::CONST_INF:
constant->value = Math_INF;
constant->value = INFINITY;
break;
case GDScriptTokenizer::Token::CONST_NAN:
constant->value = Math_NAN;
constant->value = NAN;
break;
default:
return nullptr; // Unreachable.

View file

@ -526,10 +526,10 @@ Error VisualScriptExpression::_get_token(Token &r_token) {
r_token.value = Math_TAU;
} else if (id == "INF") {
r_token.type = TK_CONSTANT;
r_token.value = Math_INF;
r_token.value = INFINITY;
} else if (id == "NAN") {
r_token.type = TK_CONSTANT;
r_token.value = Math_NAN;
r_token.value = NAN;
} else if (id == "not") {
r_token.type = TK_OP_NOT;
} else if (id == "or") {

View file

@ -2182,8 +2182,8 @@ double VisualScriptMathConstant::const_value[MATH_CONSTANT_MAX] = {
Math_TAU,
2.71828182845904523536,
Math::sqrt(2.0),
Math_INF,
Math_NAN
INFINITY,
NAN
};
int VisualScriptMathConstant::get_output_sequence_port_count() const {