Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

wldfngrs
Copy link
Contributor

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

@llvmbot llvmbot added the libc label Oct 18, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 18, 2024

@llvm/pr-subscribers-libc

Author: wldfngrs (wldfngrs)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/112889.diff

1 Files Affected:

  • (modified) libc/src/math/generic/exp10f16.cpp (+1-1)
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

@wldfngrs wldfngrs changed the title changed the return cast from static_cast<float16> to fputil::cast<float16> [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> Oct 18, 2024
@wldfngrs
Copy link
Contributor Author

@lntue please review!

@lntue lntue changed the title [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> [libc] changed the return cast from static_cast<float16> to fputil::cast<float16> in exp10f16.cpp. Oct 18, 2024
@lntue lntue merged commit 803220d into llvm:main Oct 18, 2024
9 checks passed
@wldfngrs wldfngrs deleted the update_exp10f16_return_cast branch October 18, 2024 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants