[flang-commits] [flang] [llvm] [flang] Fix wrong result for exponentiation when denormal is expected (PR #205262)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 9 05:08:37 PDT 2026
================
@@ -273,6 +273,7 @@ TEST(Numeric, FPowI) {
EXPECT_EQ(RTNAME(FPow4i)(Real<4>{0.5}, Int<4>{-1}), Real<4>{2});
EXPECT_EQ(RTNAME(FPow4i)(Real<4>{-3}, Int<4>{3}), Real<4>{-27});
EXPECT_EQ(RTNAME(FPow4i)(Real<4>{-2}, Int<4>{-3}), Real<4>{-0.125});
+ EXPECT_NE(RTNAME(FPow4i)(Real<4>{2}, Int<4>{-133}), Real<4>{0});
----------------
ejose02 wrote:
Replaced EXPECT_NE(..., 0) with exact checks: std::ldexp(1, -133) for FPow4i/FPow4k, std::ldexp(1, -1070) for FPow8i, and FPow4i(2, INT_MIN) == 0 for the most-negative-exponent case. I did not add the {3}, {-2} / {7}, {-5} runtime lines from your suggestion, since runtime FPowI still uses the reciprocal path for |base| > 1 and those cases are covered in folding07.f90 for constant folding.
https://github.com/llvm/llvm-project/pull/205262
More information about the flang-commits
mailing list