1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Fix abs() usage for Ubuntu 18.04

abs(unsigned long long) is not a thing so Ubuntu 18.04 compiling fails.
Using std::fabs() instead which handles this better (casts as double).
This commit is contained in:
Andrew Hutchings
2019-10-07 09:26:18 +01:00
parent 4aacbc5b6b
commit 986e5412e0

View File

@ -304,8 +304,8 @@ mcsv1_UDAF::ReturnCode Moda_impl_T<T>::evaluate(mcsv1Context* context, static_an
else if (iter->second == maxCnt)
{
// Tie breaker: choose the closest to avg. If still tie, choose smallest
if ((abs(val-avg) > abs(iter->first-avg))
|| ((abs(val-avg) == abs(iter->first-avg)) && (abs(val) > abs(iter->first))))
if ((std::fabs(val-avg) > std::fabs(iter->first-avg))
|| ((std::fabs(val-avg) == std::fabs(iter->first-avg)) && (std::fabs(val) > std::fabs(iter->first))))
{
val = iter->first;
}