math.h 中求根n是怎么求的

来源:百度知道 编辑:UC知道 时间:2024/06/08 06:17:44
math.h 中求根n是怎么求的
我说得是系统函数求根n是怎么编写的

早说嘛,还以为你不懂pow!
pow()的原理的源代码:

double my_pow(double x, double y)

{

register double ret, value;

double r = 1.0;

long p = (long) y;

if (x == 0.0 && y > 0.0)

return 0.0;

if (y == (double) p)

{

if (p == 0)

return 1.0;

if (p < 0)

{

p = -p;

x = 1.0 / x;

}

while (1)

{

if (p & 1)

r *= x;

p >>= 1;

if (p == 0)

return r;

x *= x;

}

}

__asm__(

"fmul %%st(1);"

"fst %%st(1);"

"frndint;\n\t"

"fxch;\n\t"

"fsu