[libc-commits] [libc] [llvm] [libc][math][c23] Add acospibf16 math function (PR #190477)
via libc-commits
libc-commits at lists.llvm.org
Sat Apr 4 11:20:02 PDT 2026
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/acospibf16.h libc/src/__support/math/acospibf16.h libc/src/math/acospibf16.h libc/src/math/generic/acospibf16.cpp libc/test/src/math/acospibf16_test.cpp libc/test/src/math/smoke/acospibf16_test.cpp libc/shared/math.h libc/test/shared/shared_math_test.cpp --diff_from_common_commit
``````````
: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/src/__support/math/acospibf16.h b/libc/src/__support/math/acospibf16.h
index 9d480897f..795f95dcd 100644
--- a/libc/src/__support/math/acospibf16.h
+++ b/libc/src/__support/math/acospibf16.h
@@ -25,9 +25,9 @@ LIBC_INLINE bfloat16 acospibf16(bfloat16 x) {
// Generated by Sollya using the following command:
// > display = hexadecimal;
// > round(pi/2, SG, RN);
-// constexpr float PI_2 = 0x1.921fb6p0f;
+ // constexpr float PI_2 = 0x1.921fb6p0f;
// > round(pi, SG, RN);
-// constexpr float PI = 0x1.921fb6p1;
+ // constexpr float PI = 0x1.921fb6p1;
using FPBits = fputil::FPBits<bfloat16>;
FPBits xbits(x);
diff --git a/libc/test/shared/shared_math_test.cpp b/libc/test/shared/shared_math_test.cpp
index d6999598a..1bff85c48 100644
--- a/libc/test/shared/shared_math_test.cpp
+++ b/libc/test/shared/shared_math_test.cpp
@@ -444,7 +444,8 @@ TEST(LlvmLibcSharedMathTest, AllFloat128) {
TEST(LlvmLibcSharedMathTest, AllBFloat16) {
using FPBits = LIBC_NAMESPACE::fputil::FPBits<bfloat16>;
- EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::acospibf16(bfloat16(1.0)));
+ EXPECT_FP_EQ(bfloat16(0.0),
+ LIBC_NAMESPACE::shared::acospibf16(bfloat16(1.0)));
EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::atanbf16(bfloat16(0.0)));
EXPECT_FP_EQ(bfloat16(0.0), LIBC_NAMESPACE::shared::asinbf16(bfloat16(0.0)));
EXPECT_FP_EQ(bfloat16(5.0), LIBC_NAMESPACE::shared::bf16add(2.0, 3.0));
diff --git a/libc/test/src/math/smoke/acospibf16_test.cpp b/libc/test/src/math/smoke/acospibf16_test.cpp
index 1aaa653e4..55ef35840 100644
--- a/libc/test/src/math/smoke/acospibf16_test.cpp
+++ b/libc/test/src/math/smoke/acospibf16_test.cpp
@@ -26,8 +26,7 @@ public:
aNaN, LIBC_NAMESPACE::acospibf16(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_ALL_ROUNDING(bfloat16(0.5),
- LIBC_NAMESPACE::acospibf16(zero));
+ EXPECT_FP_EQ_ALL_ROUNDING(bfloat16(0.5), LIBC_NAMESPACE::acospibf16(zero));
EXPECT_MATH_ERRNO(0);
EXPECT_FP_EQ_ALL_ROUNDING(bfloat16(0.5),
``````````
</details>
https://github.com/llvm/llvm-project/pull/190477
More information about the libc-commits
mailing list