Added erf to Math.

This commit is contained in:
Relintai 2023-04-22 13:00:28 +02:00
parent e80dfcee2e
commit 25e57a4268
3 changed files with 8 additions and 0 deletions

View File

@ -1652,6 +1652,7 @@ void _Math::_bind_methods() {
ClassDB::bind_method(D_METHOD("log10", "x"), &_Math::log10);
ClassDB::bind_method(D_METHOD("log2", "x"), &_Math::log2);
ClassDB::bind_method(D_METHOD("exp", "x"), &_Math::exp);
ClassDB::bind_method(D_METHOD("erf", "x"), &_Math::erf);
ClassDB::bind_method(D_METHOD("is_nan", "val"), &_Math::is_nan);
ClassDB::bind_method(D_METHOD("is_inf", "val"), &_Math::is_inf);

View File

@ -530,6 +530,10 @@ public:
return Math::exp(p_x);
}
_ALWAYS_INLINE_ real_t erf(real_t p_x) {
return Math::erf(p_x);
}
_ALWAYS_INLINE_ bool is_nan(real_t p_val) {
return Math::is_nan(p_val);
}

View File

@ -117,6 +117,9 @@ public:
static _ALWAYS_INLINE_ double exp(double p_x) { return ::exp(p_x); }
static _ALWAYS_INLINE_ float exp(float p_x) { return ::expf(p_x); }
static _ALWAYS_INLINE_ double erf(double p_x) { return ::erf(p_x); }
static _ALWAYS_INLINE_ float erf(float p_x) { return ::erff(p_x); }
// can save typing static_cast<float>
inline static float divf(const float a, const float b) { return a / b; }