[libc-commits] [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> (PR #112889)

via libc-commits libc-commits at lists.llvm.org
Fri Oct 18 04:57:50 PDT 2024


https://github.com/wldfngrs created https://github.com/llvm/llvm-project/pull/112889

switch to fputil::cast to fix rounding with compiler-rt

>From a67c29b9a875fe82717b0793012c6ed8ec457252 Mon Sep 17 00:00:00 2001
From: wldfngrs <wldfngrs at gmail.com>
Date: Fri, 18 Oct 2024 12:51:26 +0100
Subject: [PATCH] changed the return cast from static_cast<float16> to
 fputil::cast<float16>

---
 libc/src/math/generic/exp10f16.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/math/generic/exp10f16.cpp b/libc/src/math/generic/exp10f16.cpp
index f7a8ee3245eda6..006dd5c5544285 100644
--- a/libc/src/math/generic/exp10f16.cpp
+++ b/libc/src/math/generic/exp10f16.cpp
@@ -124,7 +124,7 @@ LLVM_LIBC_FUNCTION(float16, exp10f16, (float16 x)) {
 
   // 10^x = 2^((hi + mid) * log2(10)) * 10^lo
   auto [exp2_hi_mid, exp10_lo] = exp10_range_reduction(x);
-  return static_cast<float16>(exp2_hi_mid * exp10_lo);
+  return fputil::cast<float16>(exp2_hi_mid * exp10_lo);
 }
 
 } // namespace LIBC_NAMESPACE_DECL



More information about the libc-commits mailing list