如何:POW(真实的,真实)的86
问题描述:
我在寻找 POW(真实的,真实)
的x86汇编的实现。此外,我想了解的算法是如何工作的。
I'm searching for the implementation of pow(real, real)
in x86 assembler. Also I'd like to understand how the algorithm works.
答
就计算为 2 ^(Y * LOG2(X))
。
有一个x86指令FYL2X计算Y * LOG2(x)和x86指令F2XM1做求幂。 F2XM1要求[-1,1]范围内的参数,所以你必须要加一些code之间提取整数部分,其余部分,exponentiate其余,使用FSCALE通过适当的电源规模的结果2。
There is a x86 instruction FYL2X to compute y*log2(x) and a x86 instruction F2XM1 to do exponentiation. F2XM1 requires an argument in [-1,1] range, so you'd have to add some code in between to extract the integer part and the remainder, exponentiate the remainder, use FSCALE to scale the result by an appropriate power of 2.