【发布时间】:2012-06-18 09:28:16
【问题描述】:
android 支持 log2 吗?
我已经发现android不支持long double。
当我尝试编译 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)
在这里找到完整的source code。
【问题讨论】:
-
log2(x) = log(x) / log(2),因此您可以轻松滚动自己(首先计算log(2))。 -
谢谢,我记得在学校的数学课上。但我做不到,因为我只能改变一些编译键。或者寻找另一种神奇的方式来支持 log2 功能。我有兴趣默认支持 Android 中的 log2。正如我已经说过的,也许有一些神奇的钥匙。
标签: android c android-x86