android支持log2吗?
我已经发现android不支持长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)

在这里找到fullsource code

最佳答案

你神奇的方式来了。我已经测试过了并且工作过:

make CXXFLAGS="-Dlog2\(x\)=\(log\(x\)/log\(2\)\)"

更快的计算速度:
make CXXFLAGS="-Dlog2\(x\)=\(log\(x\)*1.4426950408889634\)"

07-26 09:35