[libc-commits] [libc] [libc][math][c23] Add rsqrtf16() function (PR #137545)

via libc-commits libc-commits at lists.llvm.org
Wed Apr 30 13:30:40 PDT 2025


amemov wrote:

Trying to figure out what would be the best option to compute the result.
I found that the current polynomial produces the least errors ( bigger ones yield negligible results )
`P = fpminimax(1/sqrt(x), [|0,1,2,3,4,5|], [|SG...|], [0.5, 1]);
`
And has ULP Error = 1.0



Also found this already existing implementation: https://github.com/llvm/llvm-project/blob/ae6b4b23ea4291e937192a3c08d0f3c9835864c2/libc/src/__support/fixed_point/sqrt.h#L39
It has some other interesting points that I found when I was doing my research: specifically, Newton's method. I tried adding one iteration of it, but same: it didn't help much. 

https://github.com/llvm/llvm-project/pull/137545


More information about the libc-commits mailing list