Displaying 1 result from an estimated 1 matches for "__frsqrte".
2000 Nov 26
5
Another good optimization (for PPC only, though)
...const float half = 0.5;
const float one = 1.0;
float B, y0, y1;
// This'll NaN if it hits frsqrte
if (x == 0.0)
return x;
B = x;
#ifdef __GNUC__
asm("frsqrte %0,%1" : "=f" (y0) : "f" (B));
#else
y0 = __frsqrte(B);
#endif
/* First refinement step */
y1 = y0 + half*y0*(one - B*y0*y0);
/* Second refinement step */
y0 = y1;
y1 = y0 + half*y0*(one - B*y0*y0);
/* Now that we have a good estimate of 1/sqrt(x) we need to invert it. We will also approximate this. */
B = y1;
#i...