Lines Matching defs:sqrt
30 /* sqrt(x)
31 * Return correctly rounded sqrt.
34 * | Use the hardware sqrt if you have one |
42 * sqrt(x) = 2^k * sqrt(y)
44 * Let q = sqrt(y) truncated to i bit after binary point (q = 1),
93 * sqrt(+-0) = +-0 ... exact
94 * sqrt(inf) = inf
95 * sqrt(-ve) = NaN ... with invalid signal
96 * sqrt(NaN) = NaN ... with invalid signal for signaling NaN
105 sqrt (double x)
117 return x * x + x; /* sqrt(NaN) = NaN, sqrt(+inf) = +inf, sqrt(-inf) = sNaN */
122 if (((ix0 & (~sign)) | ix1) == 0) /* sqrt(+-0) = +-0 */
126 else if (ix0 < 0) /* sqrt(-ve) = sNaN */
158 /* generate sqrt(x) bit by bit */
161 q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */
241 } /* sqrt */
252 Two algorithms are given here to implement sqrt(x)
254 Both supply sqrt(x) correctly rounded. The first algorithm (in
265 A. sqrt(x) by Newton Iteration
283 as integers), we obtain an 8-bit approximation of sqrt(x) as
287 y0 := k - T1[31&(k>>15)]. ... y ~ sqrt(x) to 8 bits
291 approximates sqrt(x) to almost 8-bit.
303 sqrt(x) to within 1 ulp (Unit in the Last Place):
312 y := (y+x/y) ... almost 17 sig. bits to 2*sqrt(x)
313 y := y - 0x00100006 ... almost 18 sig. bits to sqrt(x)
346 return sqrt(x):=y.
351 i := TRUE; ... sqrt(x) is inexact
360 return sqrt(x):=y.
367 B. sqrt(x) by Reciproot Iteration
374 we obtain a 7.8-bit approximation of 1/sqrt(x) as follows.
377 y0:= k - T2[63&(k>>14)]. ... y ~ 1/sqrt(x) to 7.8 bits
382 its trailing word y1 is set to zero) approximates 1/sqrt(x)
399 result by x to get an approximation z that matches sqrt(x)
401 -1ulp < sqrt(x)-z<1.0625ulp.
404 y := y*(1.5-0.5*x*y*y) ... almost 15 sig. bits to 1/sqrt(x)
405 y := y*((1.5-2^-30)+0.5*x*y*y)... about 29 sig. bits to 1/sqrt(x)
407 z := x*y ... 29 bits to sqrt(x), with z*y<1
408 z := z + 0.5*z*(1-z*y) ... about 1 ulp to sqrt(x)
413 -1 ulp < sqrt(x) - z < 1.0625 ulp
414 instead of |sqrt(x)-z|<1.03125ulp.
463 return sqrt(x):=z.