diff options
author | aosipenko <aosipenko@yandex-team.ru> | 2022-02-10 16:48:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:08 +0300 |
commit | 69e3c43df1c96bc2ac8946bf4dfb1f5fc438ff7f (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 /util/generic/ymath.cpp | |
parent | 948fd24d47d4b3b7815aaef1686aea00ef3f4288 (diff) | |
download | ydb-69e3c43df1c96bc2ac8946bf4dfb1f5fc438ff7f.tar.gz |
Restoring authorship annotation for <aosipenko@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/ymath.cpp')
-rw-r--r-- | util/generic/ymath.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp index ec83f696f7..31270728f4 100644 --- a/util/generic/ymath.cpp +++ b/util/generic/ymath.cpp @@ -1,5 +1,5 @@ -#include "ymath.h" - +#include "ymath.h" + double Exp2(double x) { return pow(2.0, x); } @@ -9,23 +9,23 @@ float Exp2f(float x) { } #ifdef _MSC_VER - -double Erf(double x) { + +double Erf(double x) { static constexpr double _M_2_SQRTPI = 1.12837916709551257390; static constexpr double eps = 1.0e-7; - if (fabs(x) >= 3.75) - return x > 0 ? 1.0 : -1.0; - double r = _M_2_SQRTPI * x; - double f = r; - for (int i = 1;; ++i) { - r *= -x * x / i; - f += r / (2 * i + 1); - if (fabs(r) < eps * (2 * i + 1)) - break; - } - return f; -} - + if (fabs(x) >= 3.75) + return x > 0 ? 1.0 : -1.0; + double r = _M_2_SQRTPI * x; + double f = r; + for (int i = 1;; ++i) { + r *= -x * x / i; + f += r / (2 * i + 1); + if (fabs(r) < eps * (2 * i + 1)) + break; + } + return f; +} + #endif // _MSC_VER double LogGammaImpl(double x) { |