我可以在以下问题中找到C / C ++的类似答案:C / C ++中pow()函数的快速实现/近似
根据探查器,我的代码的瓶颈类似于以下代码:
a=rand(100,1); % a is an array of doubles b=1.2; % power can be double instead of only integers. temp=power(a,b); % this line is taking maximum time
对于我的要求,只有前3-4位有效,因此对功率的任何快速近似对我来说都是非常有用的。任何建议也可以这样做。
更多&回答...