[libc-commits] [libc] [libc][math][c23] Implemented sinpif function correctly rounded for all rounding modes. (PR #97149)

via libc-commits libc-commits at lists.llvm.org
Sat Jun 29 05:12:03 PDT 2024


================
@@ -38,6 +38,16 @@ LIBC_INLINE int64_t small_range_reduction(double x, double &y) {
   return static_cast<int64_t>(kd);
 }
 
+// Return k and y, where
+//   k = round(x * 32) and y = (x * 32) - k.
+//   => pi * x = (k + y) * pi / 32
+LIBC_INLINE int64_t small_range_reduction_mul_pi(double x, double &y) {
----------------
lntue wrote:

This range reduction for `sinpif` is correct even without FMA.  You can move it to `sincosf_utils.h`, or even inlining it in `sincospif_eval`.  Otherwise, it could be named something like`mod_exp2_m32`.

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


More information about the libc-commits mailing list