[Bug target/105246] [amdgcn] Use library call for SQRT with -ffast-math + provide additional option to use single-precsion opcode
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 13 15:52:16 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105246
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Andrew Stubbs from comment #2)
> Square root. Precision is (2**29) ULP, and supports denormals.
>
> The compiler already emits Newton Raphson iterations for division with
> -ffast-math, so I'm sure it can be done, but I'm not too clear on the
> mathematics myself.
See for instance https://math.mit.edu/~stevenj/18.335/newton-sqrt.pdf
Namely for x = sqrt(a)
x_(n+1) = ½ (x_n + a / x_n)
This has quadratic convergence.
More information about the Gcc-bugs
mailing list