[libc-commits] [libc] 803220d - [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> in exp10f16.cpp. (#112889)

via libc-commits libc-commits at lists.llvm.org
Fri Oct 18 07:24:22 PDT 2024


Author: wldfngrs
Date: 2024-10-18T10:24:19-04:00
New Revision: 803220db43207254d7fced50dcc0686c4ee65474

URL: https://github.com/llvm/llvm-project/commit/803220db43207254d7fced50dcc0686c4ee65474
DIFF: https://github.com/llvm/llvm-project/commit/803220db43207254d7fced50dcc0686c4ee65474.diff

LOG: [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> in exp10f16.cpp. (#112889)

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

Added: 
    

Modified: 
    libc/src/math/generic/exp10f16.cpp

Removed: 
    


################################################################################
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