Android支持log2吗
android支持log2吗?Android支持log2吗,android,c,android-x86,Android,C,Android X86,android支持log2吗? 我已经发现android不支持长双精度 当我试图编译cdce3.c时,我收到了以下错误: g++.dg/cdce3.C: In function 'void mlog2f(int)': g++.dg/cdce3.C:87: error: 'log2f' was not declared in this scope g++.dg/cdce3.C: In function 'void mlog2(int)': g++.dg/cdce3.C:87: error: 'lo
我已经发现android不支持长双精度 当我试图编译cdce3.c时,我收到了以下错误:
g++.dg/cdce3.C: In function 'void mlog2f(int)':
g++.dg/cdce3.C:87: error: 'log2f' was not declared in this scope
g++.dg/cdce3.C: In function 'void mlog2(int)':
g++.dg/cdce3.C:87: error: 'log2' was not declared in this scope
g++.dg/cdce3.C: In function 'void olog2f(int)':
g++.dg/cdce3.C:108: error: 'log2f' was not declared in this scope
g++.dg/cdce3.C: In function 'void olog2(int)':
g++.dg/cdce3.C:108: error: 'log2' was not declared in this scope
cdce3.c源代码的一部分:
#define DEF_MATH_FUNC(prefix, name) NI void prefix##name##f (int x) \
{ \
float yy = name##f ((float) x); \
STORE_RESULT; \
} \
NI void prefix##name (int x) \
{ \
double yy = name ((double)x); \
STORE_RESULT; \
}
#endif
.........
DEF_MATH_FUNC (m,log2)
DEF_MATH_FUNC (o,log2)
请在此处查找全文。看起来Android默认不支持log2功能。因为我在这个函数的源代码中找不到任何地方。你的神奇方法就在这里。我对它进行了测试并成功:
make CXXFLAGS="-Dlog2\(x\)=\(log\(x\)/log\(2\)\)"
更快的计算速度:
make CXXFLAGS="-Dlog2\(x\)=\(log\(x\)*1.4426950408889634\)"
log2(x)=log(x)/log(2)
,因此您可以轻松地滚动自己的(首先计算log(2)
)。谢谢,我从学校的数学课程中记住了它。但我不能这样做,因为我所能做的就是改变一些编译键。或者找到另一种支持log2功能的神奇方法。我对默认支持Android中的log2感兴趣。正如我已经说过的,可能有一些神奇的键。1/log(2)的值实际上应该是3.32192809489吗?