From 8fdb68ef7992f499b66219e626dae952e0740fcf Mon Sep 17 00:00:00 2001 From: Alexey Zatelepin Date: Fri, 16 Feb 2018 17:01:50 +0300 Subject: [PATCH] add musl_ prefix to exp10 functions to avoid confusion with symbols from the system libm --- dbms/src/Functions/FunctionsMath.h | 2 +- libs/libcommon/include/common/exp10.h | 9 +++++---- libs/libcommon/src/JSON.cpp | 2 +- libs/libcommon/src/exp10.c | 12 ++++++------ libs/libmysqlxx/src/Value.cpp | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/dbms/src/Functions/FunctionsMath.h b/dbms/src/Functions/FunctionsMath.h index 29463ea765f..23cec3f3eb1 100644 --- a/dbms/src/Functions/FunctionsMath.h +++ b/dbms/src/Functions/FunctionsMath.h @@ -484,7 +484,7 @@ using FunctionExp = FunctionMathUnaryFloat64>; using FunctionExp2 = FunctionMathUnaryFloat64>; using FunctionLog2 = FunctionMathUnaryFloat64>; -using FunctionExp10 = FunctionMathUnaryFloat64>; +using FunctionExp10 = FunctionMathUnaryFloat64>; using FunctionLog10 = FunctionMathUnaryFloat64>; using FunctionSqrt = FunctionMathUnaryFloat64>; diff --git a/libs/libcommon/include/common/exp10.h b/libs/libcommon/include/common/exp10.h index 9ed3c4765eb..14c5c8412b8 100644 --- a/libs/libcommon/include/common/exp10.h +++ b/libs/libcommon/include/common/exp10.h @@ -4,6 +4,7 @@ * For example, exp10(3) gives 1000.0000000000001 * despite the fact that 1000 is exactly representable in double and float. * Better to always use implementation from MUSL. + * Note: the musl_ prefix added to function names to avoid confusion with symbols from the system libm. */ #include /// for __THROW @@ -16,9 +17,9 @@ extern "C" { -double exp10(double x) __THROW; -double pow10(double x) __THROW; -float exp10f(float x) __THROW; -float pow10f(float x) __THROW; +double musl_exp10(double x) __THROW; +double musl_pow10(double x) __THROW; +float musl_exp10f(float x) __THROW; +float musl_pow10f(float x) __THROW; } diff --git a/libs/libcommon/src/JSON.cpp b/libs/libcommon/src/JSON.cpp index ab8e71f22fe..ef629843cc9 100644 --- a/libs/libcommon/src/JSON.cpp +++ b/libs/libcommon/src/JSON.cpp @@ -147,7 +147,7 @@ static double readFloatText(const char * buf, const char * end) { ++buf; Int32 exponent = readIntText(buf, end); - x *= exp10(exponent); + x *= musl_exp10(exponent); run = false; break; diff --git a/libs/libcommon/src/exp10.c b/libs/libcommon/src/exp10.c index 887d543bdda..2c92fb7a1bd 100644 --- a/libs/libcommon/src/exp10.c +++ b/libs/libcommon/src/exp10.c @@ -172,7 +172,7 @@ obstacle to adoption, that text has been removed. #include #include -double exp10(double x) +double musl_exp10(double x) { static const double p10[] = { 1e-15, 1e-14, 1e-13, 1e-12, 1e-11, 1e-10, @@ -191,7 +191,7 @@ double exp10(double x) return pow(10.0, x); } -float exp10f(float x) +float musl_exp10f(float x) { static const float p10[] = { 1e-7f, 1e-6f, 1e-5f, 1e-4f, 1e-3f, 1e-2f, 1e-1f, @@ -208,12 +208,12 @@ float exp10f(float x) return exp2(3.32192809488736234787031942948939 * x); } -double pow10(double x) +double musl_pow10(double x) { - return exp10(x); + return musl_exp10(x); } -float pow10f(float x) +float musl_pow10f(float x) { - return exp10f(x); + return musl_exp10f(x); } diff --git a/libs/libmysqlxx/src/Value.cpp b/libs/libmysqlxx/src/Value.cpp index 9492d4398ca..9ef791d93fb 100644 --- a/libs/libmysqlxx/src/Value.cpp +++ b/libs/libmysqlxx/src/Value.cpp @@ -127,7 +127,7 @@ double Value::readFloatText(const char * buf, size_t length) const { ++buf; Int32 exponent = readIntText(buf, end - buf); - x *= exp10(exponent); + x *= musl_exp10(exponent); if (negative) x = -x; return x;