[libc-commits] [libc] [libc][math] Implement double precision tgamma (PR #210970)
via libc-commits
libc-commits at lists.llvm.org
Tue Jul 21 05:44:27 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/src/__support/math/tgamma.h libc/src/math/generic/tgamma.cpp libc/test/src/math/smoke/tgamma_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/test/src/math/smoke/tgamma_test.cpp b/libc/test/src/math/smoke/tgamma_test.cpp
index 261598b36..458aeb6b8 100644
--- a/libc/test/src/math/smoke/tgamma_test.cpp
+++ b/libc/test/src/math/smoke/tgamma_test.cpp
@@ -17,7 +17,8 @@ TEST_F(LlvmLibcTgammaTest, SpecialNumbers) {
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tgamma(sNaN), FE_INVALID);
EXPECT_MATH_ERRNO(0);
- EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tgamma(neg_inf), FE_INVALID);
+ EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tgamma(neg_inf),
+ FE_INVALID);
EXPECT_MATH_ERRNO(EDOM);
EXPECT_FP_EQ_WITH_EXCEPTION(aNaN, LIBC_NAMESPACE::tgamma(-1.0), FE_INVALID);
@@ -26,12 +27,14 @@ TEST_F(LlvmLibcTgammaTest, SpecialNumbers) {
EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::tgamma(zero), FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
- EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::tgamma(neg_zero), FE_DIVBYZERO);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_inf, LIBC_NAMESPACE::tgamma(neg_zero),
+ FE_DIVBYZERO);
EXPECT_MATH_ERRNO(ERANGE);
-
+
// Source: https://members.loria.fr/PZimmermann/papers/gamma.pdf
// Gamma(0x1.573fae561f648p+7) > DBL_MAX
- EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::tgamma(0x1.573fae561f648p+7), FE_OVERFLOW);
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, LIBC_NAMESPACE::tgamma(0x1.573fae561f648p+7),
+ FE_OVERFLOW);
EXPECT_MATH_ERRNO(ERANGE);
// One ULP below 0x1.573fae561f648p+7
``````````
</details>
https://github.com/llvm/llvm-project/pull/210970
More information about the libc-commits
mailing list