[libc-commits] [libc] [llvm] [libc][math] Implement single precision lgamma function (PR #205490)

via libc-commits libc-commits at lists.llvm.org
Tue Jul 28 07:06:06 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 h,cpp -- libc/shared/math/lgammaf.h libc/src/__support/math/gamma_util.h libc/src/__support/math/lgammaf.h libc/src/math/generic/lgammaf.cpp libc/src/math/lgammaf.h libc/test/src/math/exhaustive/lgammaf_test.cpp libc/test/src/math/lgammaf_test.cpp libc/test/src/math/smoke/lgammaf_test.cpp libc/shared/math.h libc/src/__support/math/lgammaf16.h --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/lgammaf.h b/libc/src/__support/math/lgammaf.h
index e2f0a16aa..e5c0f818b 100644
--- a/libc/src/__support/math/lgammaf.h
+++ b/libc/src/__support/math/lgammaf.h
@@ -405,7 +405,7 @@ LIBC_INLINE float lgammaf(float x) {
       double inv_x2 = inv_x * inv_x;
       if (x_abs > 0x44fa0000u) {
         constexpr fputil::ExceptValues<float, 3> LGAMMAF_EXCEPTS_BERN2{{
-        // input,      toward-zero result, RU, RD, RN
+            // input,      toward-zero result, RU, RD, RN
             {0x46541516u, 0x47e1c01bu, 1, 0, 0},
             {0x46b16323u, 0x48483adeu, 1, 0, 1},
             {0xc6f7e151u, 0xc89116deu, 0, 1, 0},
@@ -420,7 +420,7 @@ LIBC_INLINE float lgammaf(float x) {
       } else if (x_abs > 0x42920000u) {
         // Exceptional cases of this range.
         constexpr fputil::ExceptValues<float, 2> LGAMMAF_EXCEPTS_BERN4{{
-        // input,      toward-zero result, RU, RD, RN
+            // input,      toward-zero result, RU, RD, RN
             {0x449acf07u, 0x45ecd680u, 1, 0, 1},
             {0xc33139a3u, 0xc43991afu, 0, 1, 0},
         }};
@@ -438,7 +438,7 @@ LIBC_INLINE float lgammaf(float x) {
       } else {
         // Exceptional cases of this range.
         constexpr fputil::ExceptValues<float, 2> LGAMMAF_EXCEPTS_B10{{
-        // input,      toward-zero result, RU, RD, RN
+            // input,      toward-zero result, RU, RD, RN
             {0x42468b59u, 0x430f25a7u, 1, 0, 0},
             {0xc134eb14u, 0xc1875615u, 0, 1, 0},
         }};
@@ -472,7 +472,7 @@ LIBC_INLINE float lgammaf(float x) {
       }
     } else {
       constexpr fputil::ExceptValues<float, 3> LGAMMAF_EXCEPTS_HUGE{{
-        // input,      toward-zero result, RU, RD, RN
+          // input,      toward-zero result, RU, RD, RN
           {0x65fca09fu, 0x68cead59u, 1, 0, 1},
           {0x716e5dd5u, 0x747e2bb9u, 1, 0, 0},
           {0x77ac5674u, 0x7acf27b2u, 1, 0, 1},

``````````

</details>


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


More information about the libc-commits mailing list