diff options
author | nae202 <nae202@yandex-team.com> | 2024-11-20 12:52:01 +0300 |
---|---|---|
committer | nae202 <nae202@yandex-team.com> | 2024-11-20 13:14:09 +0300 |
commit | 0b9d91e900b52bccd6eabd033acbb57c4ee173fc (patch) | |
tree | 6839ed69fbda4d5214eb418acc4554924bc64160 /util/generic/ymath.cpp | |
parent | 878e26057d11cce46b7bc3a6c838209d4686e28b (diff) | |
download | ydb-0b9d91e900b52bccd6eabd033acbb57c4ee173fc.tar.gz |
Part of PR. Style
Часть большого ПР REVIEW:7264088
commit_hash:0f5b03fbbed0ac30f734943309e3ef5cd4d7a30e
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; } |