衆所周知,計算機的基本數值算法是加減乘除,甚至隻是加減法。而次方和開根算法都是由四則運算混合表示而成的,因而根号計算比四則運算要慢很多。無理數如√2的浮點數計算就是由牛頓疊代法得出的。牛頓疊代法是一種用于計算曲線方程根的精确算法(尤其是幂函數方程),比二分法更加高效,因為它基于微分。
Or even only the addition and subtraction. But the power and
root algorithm is a complex combination of the four fundamental
operations, so they are much slower. Irrational numbers such as √2
whose floating point is obtained by the Newton-Raphson method.
Newton-Raphson method is a precise algorithm used to calculate the
curvilinear equation (especiallypower function), it’s more
efficient than Dichotomy because it is based on the
differential.

以計算√x(精度e)為例的c語言函數:
A example using C language calculating √x with precision
’e’:
double abs_value(double x)
{
if(x<0)x=-x;
return x;
}
double sqrt_root(double x,double e)
double x0=1;
while(abs_value(x0*x0-x)>e)
X0=(x0+x/x0)/2;
return x0;