summaryrefslogtreecommitdiffstats
path: root/util/generic/ymath.cpp
diff options
context:
space:
mode:
authoraosipenko <[email protected]>2022-02-10 16:48:08 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:48:08 +0300
commit948fd24d47d4b3b7815aaef1686aea00ef3f4288 (patch)
tree8ad4c39c2a5f8b341bc02e3b0c5e8f26c40373cb /util/generic/ymath.cpp
parentd2eb4aae699fa2f6901bf32d22eec019c8f29838 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/generic/ymath.cpp')
-rw-r--r--util/generic/ymath.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp
index 31270728f46..ec83f696f79 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) {