[libc-commits] [libc] [libc][math][c23] add sinpi function (PR #129379)

via libc-commits libc-commits at lists.llvm.org
Sat Mar 1 04:03:42 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 0751418024442ac97b8ff484c01f9386aa5723b8 b4d31d0b5c0303e25054dcb43fcd1db41684f1c7 --extensions cpp -- libc/src/math/generic/sinpi.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/math/generic/sinpi.cpp b/libc/src/math/generic/sinpi.cpp
index 69116ced9f..681d67a1f1 100644
--- a/libc/src/math/generic/sinpi.cpp
+++ b/libc/src/math/generic/sinpi.cpp
@@ -39,16 +39,19 @@ LLVM_LIBC_FUNCTION(double, sinpi, (double x)) {
   if (LIBC_UNLIKELY(x_abs <= 0x3d80'0000U)) {
     if (LIBC_UNLIKELY(x_abs < 0x33CD'01D7U)) {
       if (LIBC_UNLIKELY(x_abs == 0U)) {
-	return x;
-    }
+        return x;
+      }
       long double xdpi = xd * 0x1.921fb5444d18p1;
-       return  static_cast<double>(xdpi);
+      return static_cast<double>(xdpi);
     }
-  long double xsq = xd * xd;
+    long double xsq = xd * xd;
 
-  long double result = fputil::polyeval(xsq,0x1.921fb54442d183f07b2385653d8p1, -0x1.4abbce625bd95cdc955aeed9abcp2, 0x1.466bc6769ddfdb085486c0ff3ep1, -0x1.32d2c4a48bfd71fa9cdf60a0e4p-1,  0x1.502cbd2c72e3168ff209bc7656cp-4);
+    long double result = fputil::polyeval(
+        xsq, 0x1.921fb54442d183f07b2385653d8p1,
+        -0x1.4abbce625bd95cdc955aeed9abcp2, 0x1.466bc6769ddfdb085486c0ff3ep1,
+        -0x1.32d2c4a48bfd71fa9cdf60a0e4p-1, 0x1.502cbd2c72e3168ff209bc7656cp-4);
 
-  return static_cast<double>(xd * result);
+    return static_cast<double>(xd * result);
   }
 
   long double sin_k, cos_k, sin_y, cosm1_y;
@@ -58,6 +61,6 @@ LLVM_LIBC_FUNCTION(double, sinpi, (double x)) {
     return FPBits::zero(xbits.sign()).get_val();
 
   return static_cast<double>(fputil::multiply_add(
-						  sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
-}
+      sin_y, cos_k, fputil::multiply_add(cosm1_y, sin_k, sin_k)));
 }
+} // namespace LIBC_NAMESPACE_DECL

``````````

</details>


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


More information about the libc-commits mailing list