[Mlir-commits] [mlir] [MLIR][Math] Add erfc to math dialect (PR #126439)

Benoit Jacob llvmlistbot at llvm.org
Fri Feb 14 07:42:15 PST 2025


================
@@ -543,6 +543,28 @@ def Math_ErfOp : Math_FloatUnaryOp<"erf"> {
   let hasFolder = 1;
 }
 
+//===----------------------------------------------------------------------===//
+// ErfcOp
+//===----------------------------------------------------------------------===//
+
+def Math_ErfcOp : Math_FloatUnaryOp<"erfc"> {
+  let summary = "complementary error function of the specified value";
+  let description = [{
+    The `erfc` operation computes the complementary error function.
+    It takes one operand of floating point type (i.e., scalar, tensor or
+    vector) and returns one result of the same type.
+    It has no standard attributes.
----------------
bjacob wrote:

Maybe also a word on why it exists as a separate op, as opposed to letting people write `1 - erf(x)`  (it's about floating point accuracy vs cancellation when erf(x) is close to 1, and it's standard in the C math.h library etc).

https://github.com/llvm/llvm-project/pull/126439


More information about the Mlir-commits mailing list