[llvm] [APFloat] add power (PR #122889)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 17 01:09:03 PST 2025
================
@@ -1536,6 +1536,26 @@ inline APFloat abs(APFloat X) {
return X;
}
+/// Returns X^N for N >= 0.
+inline APFloat powi(const APFloat &X, int64_t N) {
+ assert(N >= 0 && "negative exponents not supported.");
+ APFloat Acc = APFloat::getOne(X.getSemantics());
+ if (N == 0) {
+ return Acc;
----------------
arsenm wrote:
All paths through the function, but yes this one too. Signaling nans should be quieted
https://github.com/llvm/llvm-project/pull/122889
More information about the llvm-commits
mailing list