Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
" %s input = (abs_arg < 1.0) ? x : 1.0 / x;\n"
/* HLSL pow(x, y) always returns NaN if x<0. So write out the powers longhand. */
" %s x2 = input * input;\n"
" %s x3 = input * x2;\n"
" %s x5 = x3 * x2;\n"
" %s x7 = x5 * x2;\n"
" %s x9 = x7 * x2;\n"
" %s poly_approx = \n"
" 0.020265052 * x9\n"
" + -0.0840074 * x7\n"
" + 0.17941668 * x5\n"
" + -0.3301321 * x3\n"
" + 0.99985593 * input;\n"
" return (abs_arg < 1.0)\n"
" ? poly_approx\n"
" : (((x < 0.0 ? -1 : 1) * 3.14159265 / 2.0) - poly_approx);\n"
Here too please use the same formula and coefficients as native, see for example https://shader-playground.timjones.io/b97163caaa9e111291dc673f7c9060cb.