aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic
diff options
context:
space:
mode:
authorjacob <jacob@yandex-team.ru>2022-02-10 16:49:53 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:53 +0300
commit1bf57447b8a115cd60bb6f8509b9b148e1b6debd (patch)
treeb9f3ce9adae968ad4924f36058b631b58ef03e57 /util/generic
parent3bf10d3f40b502d181ef52f5c4602c98cb135360 (diff)
downloadydb-1bf57447b8a115cd60bb6f8509b9b148e1b6debd.tar.gz
Restoring authorship annotation for <jacob@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic')
-rw-r--r--util/generic/vector_ut.cpp2
-rw-r--r--util/generic/ymath.cpp6
-rw-r--r--util/generic/ymath.h6
-rw-r--r--util/generic/ymath_ut.cpp24
4 files changed, 19 insertions, 19 deletions
diff --git a/util/generic/vector_ut.cpp b/util/generic/vector_ut.cpp
index 0f6b4037a0..4f13bbae51 100644
--- a/util/generic/vector_ut.cpp
+++ b/util/generic/vector_ut.cpp
@@ -427,7 +427,7 @@ private:
v.shrink_to_fit();
UNIT_ASSERT_EQUAL(v.capacity(), 11);
}
-
+
/* This test check a potential issue with empty base class
* optimization. Some compilers (VC6) do not implement it
* correctly resulting ina wrong behavior. */
diff --git a/util/generic/ymath.cpp b/util/generic/ymath.cpp
index 31270728f4..18a9f61a23 100644
--- a/util/generic/ymath.cpp
+++ b/util/generic/ymath.cpp
@@ -27,7 +27,7 @@ double Erf(double x) {
}
#endif // _MSC_VER
-
+
double LogGammaImpl(double x) {
static constexpr double lnSqrt2Pi = 0.91893853320467274178; // log(sqrt(2.0 * PI))
static constexpr double coeff9 = 1.0 / 1188.0;
@@ -35,7 +35,7 @@ double LogGammaImpl(double x) {
static constexpr double coeff5 = 1.0 / 1260.0;
static constexpr double coeff3 = -1.0 / 360.0;
static constexpr double coeff1 = 1.0 / 12.0;
-
+
if ((x == 1.0) || (x == 2.0)) {
return 0.0; // 0! = 1
}
@@ -53,4 +53,4 @@ double LogGammaImpl(double x) {
res /= x;
res += x * lnX - x + lnSqrt2Pi - 0.5 * lnX;
return res + bonus;
-}
+}
diff --git a/util/generic/ymath.h b/util/generic/ymath.h
index 9ff9ae2abe..edf992caa0 100644
--- a/util/generic/ymath.h
+++ b/util/generic/ymath.h
@@ -99,7 +99,7 @@ inline double Erf(double x) {
return erf(x);
}
#endif
-
+
/**
* @returns Natural logarithm of the absolute value
* of the gamma function of provided argument.
@@ -114,8 +114,8 @@ inline double LogGamma(double x) noexcept {
#elif defined(__GNUC__)
return __builtin_lgamma(x);
#elif defined(_unix_)
- return lgamma(x);
-#else
+ return lgamma(x);
+#else
extern double LogGammaImpl(double);
return LogGammaImpl(x);
#endif
diff --git a/util/generic/ymath_ut.cpp b/util/generic/ymath_ut.cpp
index 29190b55eb..f7ff2298ba 100644
--- a/util/generic/ymath_ut.cpp
+++ b/util/generic/ymath_ut.cpp
@@ -149,19 +149,19 @@ void TMathTest::TestErf() {
UNIT_ASSERT_DOUBLES_EQUAL(f, values[i], 1e-7);
}
}
-
-void TMathTest::TestLogGamma() {
- double curVal = 0.0;
- for (int i = 1; i <= 20; i++) {
- curVal += log((double)i);
+
+void TMathTest::TestLogGamma() {
+ double curVal = 0.0;
+ for (int i = 1; i <= 20; i++) {
+ curVal += log((double)i);
UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma((double)(i + 1)), 1e-6);
- }
- curVal = log(M_PI) / 2.0;
- for (int i = 1; i <= 20; i++) {
- UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma(i - 0.5), 1e-6);
- curVal += log(i - 0.5);
- }
-}
+ }
+ curVal = log(M_PI) / 2.0;
+ for (int i = 1; i <= 20; i++) {
+ UNIT_ASSERT_DOUBLES_EQUAL(curVal, LogGamma(i - 0.5), 1e-6);
+ curVal += log(i - 0.5);
+ }
+}
void TMathTest::TestAbs() {
UNIT_ASSERT_VALUES_EQUAL(Abs(1), 1);