[libc-commits] [libc] [libc] fix build errors caused by cbrt. (PR #151879)

Muhammad Bassiouni via libc-commits libc-commits at lists.llvm.org
Sun Aug 3 11:19:36 PDT 2025


https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/151879

>From 5a24d3de61f8ddb36936a57140a3dc6b2ab7e53d Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Sun, 3 Aug 2025 21:14:03 +0300
Subject: [PATCH 1/2] [libc] fix build errors caused by cbrt.

---
 libc/src/__support/math/cbrt.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libc/src/__support/math/cbrt.h b/libc/src/__support/math/cbrt.h
index 2b9a73c823b14..360e68aafb75d 100644
--- a/libc/src/__support/math/cbrt.h
+++ b/libc/src/__support/math/cbrt.h
@@ -146,7 +146,6 @@ LIBC_INLINE static constexpr double get_error(const DoubleDouble &x_3,
 
 LIBC_INLINE static constexpr double cbrt(double x) {
   using DoubleDouble = fputil::DoubleDouble;
-  using Float128 = fputil::DyadicFloat<128>;
   using namespace cbrt_internal;
   using FPBits = fputil::FPBits<double>;
 

>From 6a312f523f1cc2c1c23e2ec74dfd8c5c9b55ca47 Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Sun, 3 Aug 2025 21:19:11 +0300
Subject: [PATCH 2/2] add type alias

---
 libc/src/__support/math/cbrt.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libc/src/__support/math/cbrt.h b/libc/src/__support/math/cbrt.h
index 360e68aafb75d..9d86bf3dab8b3 100644
--- a/libc/src/__support/math/cbrt.h
+++ b/libc/src/__support/math/cbrt.h
@@ -294,6 +294,8 @@ LIBC_INLINE static constexpr double cbrt(double x) {
   if (LIBC_LIKELY(r2_upper == r2_lower))
     return update_exponent(r2_upper);
 
+  using Float128 = fputil::DyadicFloat<128>;
+
   // TODO: Investigate removing float128 and just list exceptional cases.
   // Apply another Newton iteration with ~126-bit accuracy.
   Float128 x2_f128 = fputil::quick_add(Float128(x2.hi), Float128(x2.lo));



More information about the libc-commits mailing list