ITeye博客

Fast implementation/approximation of pow() function in C/C++

vergilwang · 2013-03-29 16:42 · Algorithm · C++ · 互联网 · Markdown

老外的帖子

Sure - it's easy if you have exponential and natural log functions.

Sincey = x^n, you can take the natural log of both sides:

ln(y)= n*ln(x)

Then taking the exponential of both sides gives you what you want:

y = exp(n*ln(x))

If you want something better, the best place I know to look isAbramowitz and Stegun.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。