add musl_ prefix to exp10 functions to avoid confusion with symbols from the system libm

This commit is contained in:
Alexey Zatelepin 2018-02-16 17:01:50 +03:00
parent 704fe146fb
commit 8fdb68ef79
5 changed files with 14 additions and 13 deletions

View File

@ -484,7 +484,7 @@ using FunctionExp = FunctionMathUnaryFloat64<UnaryFunctionVectorized<ExpName, ex
using FunctionLog = FunctionMathUnaryFloat64<UnaryFunctionVectorized<LogName, log>>;
using FunctionExp2 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Exp2Name, exp2>>;
using FunctionLog2 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Log2Name, log2>>;
using FunctionExp10 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Exp10Name, exp10>>;
using FunctionExp10 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Exp10Name, musl_exp10>>;
using FunctionLog10 = FunctionMathUnaryFloat64<UnaryFunctionVectorized<Log10Name, log10>>;
using FunctionSqrt = FunctionMathUnaryFloat64<UnaryFunctionVectorized<SqrtName, sqrt>>;

View File

@ -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 <stdlib.h> /// 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;
}

View File

@ -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;

View File

@ -172,7 +172,7 @@ obstacle to adoption, that text has been removed.
#include <math.h>
#include <stdint.h>
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);
}

View File

@ -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;