[Mlir-commits] [mlir] [mlir][math]Update `convertPowfOp` `ExpandPatterns.cpp` (PR #124402)
Hyunsung Lee
llvmlistbot at llvm.org
Tue Jan 28 17:08:49 PST 2025
================
@@ -311,40 +311,40 @@ static LogicalResult convertFPowIOp(math::FPowIOp op,
return success();
}
-// Converts Powf(float a, float b) (meaning a^b) to exp^(b * ln(a))
+// Converts Powf(float a, float b) (meaning a^b) to exp^(b * ln(|a|))
+// * sign(a)^b
----------------
ita9naiwa wrote:
the previous implementation actually does `(exp((b / 2) * log(a^2))` and I think this trick is introduced to handle `a < 0` case,
But yes, I believe that `math.powf` should support only the case where `a>0` and `a == 0`.
Thanks for the thoughtful review @bjacob !
https://github.com/llvm/llvm-project/pull/124402
More information about the Mlir-commits
mailing list