diff options
author | Maxim Yurchuk <maxim-yurchuk@ydb.tech> | 2024-11-20 17:37:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 17:37:57 +0000 |
commit | f76323e9b295c15751e51e3443aa47a36bee8023 (patch) | |
tree | 4113c8cad473a33e0f746966e0cf087252fa1d7a /util/generic/ymath.cpp | |
parent | 753ecb8d410a4cb459c26f3a0082fb2d1724fe63 (diff) | |
parent | a7b9a6afea2a9d7a7bfac4c5eb4c1a8e60adb9e6 (diff) | |
download | ydb-f76323e9b295c15751e51e3443aa47a36bee8023.tar.gz |
Merge pull request #11788 from ydb-platform/mergelibs-241120-1113
Library import 241120-1113
Diffstat (limited to 'util/generic/ymath.cpp')
-rw-r--r-- | util/generic/ymath.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp index 31270728f4..a28a71b0e0 100644 --- a/util/generic/ymath.cpp +++ b/util/generic/ymath.cpp @@ -13,15 +13,17 @@ float Exp2f(float 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) + 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)) + if (fabs(r) < eps * (2 * i + 1)) { break; + } } return f; } |