[libc-commits] [libc] [libc][math] Fix signed zeros for powf when underflow happens. (PR #112601)
via libc-commits
libc-commits at lists.llvm.org
Thu Oct 17 21:08:34 PDT 2024
================
@@ -855,9 +855,11 @@ LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
: 0.0;
exp2_hi_mid_dd.hi = exp2_hi_mid;
- return static_cast<float>(
- powf_double_double(idx_x, dx, y6, lo6_hi, exp2_hi_mid_dd)) +
- 0.0f;
+ double r_dd = powf_double_double(idx_x, dx, y6, lo6_hi, exp2_hi_mid_dd);
+ float r_f = static_cast<float>(r_dd);
+
+ // Only fix signed zeros for exact zeros results.
+ return r_dd != 0 ? r_f : r_f + 0.0f;
----------------
lntue wrote:
I actually don't remember the exact cases that required this, and non of the current tests break without this signed zero correction. So I remove this to simplify things for now.
https://github.com/llvm/llvm-project/pull/112601
More information about the libc-commits
mailing list