@@ -51,7 +51,11 @@ LLVM_LIBC_FUNCTION(float16, acospif16, (float16 x)) {
5151
5252 float xf = x;
5353 float xsq = xf * xf;
54- constexpr float poly_coeffs[5 ] = {0x1 .45f308p-2f , 0x1 .b2900cp -5f ,
54+
55+ // Degree-6 minimax polynomial coefficients of asin(x) generated by Sollya
56+ // with: > P = fpminimax(asin(x)/(pi * x), [|0, 2, 4, 6, 8|], [|SG...|], [0,
57+ // 0.5]);
58+ constexpr float POLY_COEFFS[5 ] = {0x1 .45f308p-2f , 0x1 .b2900cp -5f ,
5559 0x1 .897e36p-6f , 0x1 .9efafcp-7f ,
5660 0x1 .06d884p-6f };
5761 // |x| <= 0x1p-1, |x| <= 0.5
@@ -62,12 +66,9 @@ LLVM_LIBC_FUNCTION(float16, acospif16, (float16 x)) {
6266
6367 // Note that: acos(x) = pi/2 + asin(-x) = pi/2 - asin(x), then
6468 // acospi(x) = 0.5 - asin(x)/pi
65- // Degree-6 minimax polynomial of asin(x) generated by Sollya with:
66- // > P = fpminimax(asin(x)/(pi * x), [|0, 2, 4, 6, 8|], [|SG...|], [0,
67- // 0.5]);
6869 float interm =
69- fputil::polyeval (xsq, poly_coeffs [0 ], poly_coeffs [1 ], poly_coeffs [2 ],
70- poly_coeffs [3 ], poly_coeffs [4 ]);
70+ fputil::polyeval (xsq, POLY_COEFFS [0 ], POLY_COEFFS [1 ], POLY_COEFFS [2 ],
71+ POLY_COEFFS [3 ], POLY_COEFFS [4 ]);
7172
7273 return fputil::cast<float16>(fputil::multiply_add (-xf, interm, 0 .5f ));
7374 }
@@ -118,11 +119,9 @@ LLVM_LIBC_FUNCTION(float16, acospif16, (float16 x)) {
118119 float u = fputil::multiply_add (-0 .5f , xf_abs, 0 .5f );
119120 float sqrt_u = fputil::sqrt<float >(u);
120121
121- // Degree-6 minimax polynomial of asin(x) generated by Sollya with:
122- // > P = fpminimax(asin(x)/(pi * x), [|0, 2, 4, 6, 8|], [|SG...|], [0, 0.5]);
123122 float asin_sqrt_u =
124- sqrt_u * fputil::polyeval (u, poly_coeffs [0 ], poly_coeffs [1 ],
125- poly_coeffs [2 ], poly_coeffs [3 ], poly_coeffs [4 ]);
123+ sqrt_u * fputil::polyeval (u, POLY_COEFFS [0 ], POLY_COEFFS [1 ],
124+ POLY_COEFFS [2 ], POLY_COEFFS [3 ], POLY_COEFFS [4 ]);
126125
127126 // Same as acos(x), but devided the expression with pi
128127 return fputil::cast<float16>(
0 commit comments