[libc-commits] [libc] [libc] Fix temporary types for fputil::split template. (PR #163813)

via libc-commits libc-commits at lists.llvm.org
Thu Oct 16 09:11:21 PDT 2025


https://github.com/lntue created https://github.com/llvm/llvm-project/pull/163813

Fix #163711.

>From 51cbb59859ac3f41c21667558909dff5599b541c Mon Sep 17 00:00:00 2001
From: Tue Ly <lntue.h at gmail.com>
Date: Thu, 16 Oct 2025 16:08:02 +0000
Subject: [PATCH] [libc] Fix temporary types for fputil::split template.

Fix #163711.
---
 libc/src/__support/FPUtil/double_double.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/src/__support/FPUtil/double_double.h b/libc/src/__support/FPUtil/double_double.h
index 8e54e845de493..9affced3d2cee 100644
--- a/libc/src/__support/FPUtil/double_double.h
+++ b/libc/src/__support/FPUtil/double_double.h
@@ -77,9 +77,9 @@ LIBC_INLINE constexpr NumberPair<T> split(T a) {
   NumberPair<T> r{0.0, 0.0};
   // CN = 2^N.
   constexpr T CN = static_cast<T>(1 << N);
-  constexpr T C = CN + 1.0;
-  double t1 = C * a;
-  double t2 = a - t1;
+  constexpr T C = CN + T(1);
+  T t1 = C * a;
+  T t2 = a - t1;
   r.hi = t1 + t2;
   r.lo = a - r.hi;
   return r;



More information about the libc-commits mailing list