[libc-commits] [libc] [libc][math] Fix spurious log10p1f16 underflow (PR #194148)

via libc-commits libc-commits at lists.llvm.org
Sat Apr 25 07:45:15 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/log10p1f16.h libc/test/src/math/smoke/log10p1f16_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/log10p1f16.h b/libc/src/__support/math/log10p1f16.h
index d8965d9b8..13f4904e7 100644
--- a/libc/src/__support/math/log10p1f16.h
+++ b/libc/src/__support/math/log10p1f16.h
@@ -106,11 +106,10 @@ LIBC_INLINE float16 log10p1f16(float16 x) {
 #endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
       float xf = x;
-      float r = xf * fputil::polyeval(xf, 0x1.bcb7b2p-2f, -0x1.bcb4cp-3f,
-                                      0x1.2875bcp-3f, -0x1.c2946ep-4f,
-                                      0x1.69da2p-4f);
-      float16 result =
-          fputil::DyadicFloat<32>(r).template as<float16, false>();
+      float r =
+          xf * fputil::polyeval(xf, 0x1.bcb7b2p-2f, -0x1.bcb4cp-3f,
+                                0x1.2875bcp-3f, -0x1.c2946ep-4f, 0x1.69da2p-4f);
+      float16 result = fputil::DyadicFloat<32>(r).template as<float16, false>();
 
       if (LIBC_UNLIKELY(static_cast<float>(result) != r)) {
         int excepts = FE_INEXACT;

``````````

</details>


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


More information about the libc-commits mailing list