[libc-commits] [libc] [llvm] [libc][math][c23] Add rsqrtf() function (PR #159615)
Anton Shepelev via libc-commits
libc-commits at lists.llvm.org
Thu Sep 18 12:04:06 PDT 2025
amemov wrote:
@lntue
I tried here to use just `float` for 1/sqrt() and then return it, but it turned out that when I was running the exhaustive tests (which I need to change so it wouldn't take forever to run `ninja check-libc`) it would fail all the time - which make sense. At least when I left the test running on my computer just for fun overnight it didn't show any errors (but at the same time it didn't finish the test and I had to stop it).
I implemented the `rsqrtf` here similarly to how I did `rsqrtf16`, but instead of using `float`, I used `double` and casted it to `float`. I suppose this implementation would be ok for now, and like with rsqrtf16 in the future we would need to change it to use approximation -- in this particular case, if hardware doesn't have double precision to fallback to float-based approximation?
https://github.com/llvm/llvm-project/pull/159615
More information about the libc-commits
mailing list