[libc-commits] [libc] [llvm] [libc][math][c23] Add rsqrtf() function (PR #159615)

via libc-commits libc-commits at lists.llvm.org
Thu Sep 18 10:49:53 PDT 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 origin/main HEAD --extensions cpp,h -- libc/shared/math/rsqrtf.h libc/src/math/generic/rsqrtf.cpp libc/src/math/rsqrtf.h libc/test/src/math/rsqrtf_test.cpp libc/test/src/math/smoke/rsqrtf_test.cpp libc/shared/math.h libc/shared/math/rsqrtf16.h libc/test/shared/shared_math_test.cpp
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/libc/test/src/math/rsqrtf_test.cpp b/libc/test/src/math/rsqrtf_test.cpp
index cedafb63a..3287dc8b5 100644
--- a/libc/test/src/math/rsqrtf_test.cpp
+++ b/libc/test/src/math/rsqrtf_test.cpp
@@ -16,7 +16,7 @@ using LlvmLibcRsqrtfTest = LIBC_NAMESPACE::testing::FPTest<float>;
 namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
 
 // Range: [0, Inf]
-static constexpr uint32_t POS_START = 0x00000000u; 
+static constexpr uint32_t POS_START = 0x00000000u;
 static constexpr uint32_t POS_STOP = 0x7F800000u;
 
 // Range: [-Inf, 0)
diff --git a/libc/test/src/math/smoke/rsqrtf_test.cpp b/libc/test/src/math/smoke/rsqrtf_test.cpp
index 9ffde79e5..02f67c437 100644
--- a/libc/test/src/math/smoke/rsqrtf_test.cpp
+++ b/libc/test/src/math/smoke/rsqrtf_test.cpp
@@ -26,9 +26,7 @@ TEST_F(LlvmLibcRsqrtfTest, SpecialNumbers) {
   EXPECT_FP_EQ(neg_inf, LIBC_NAMESPACE::rsqrtf(neg_zero));
   EXPECT_MATH_ERRNO(ERANGE);
 
-  EXPECT_FP_EQ(
-      1.0f,
-      LIBC_NAMESPACE::rsqrtf(1.0f));
+  EXPECT_FP_EQ(1.0f, LIBC_NAMESPACE::rsqrtf(1.0f));
   EXPECT_MATH_ERRNO(0);
 
   EXPECT_FP_EQ(zero, LIBC_NAMESPACE::rsqrtf(inf));

``````````

</details>


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


More information about the libc-commits mailing list