diff --git a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp --- a/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp +++ b/mlir/lib/Conversion/ComplexToStandard/ComplexToStandard.cpp @@ -738,6 +738,9 @@ auto loc = op.getLoc(); auto type = adaptor.getComplex().getType().cast(); auto elementType = type.getElementType().cast(); + // The hyperbolic tangent for complex number can be calculated as follows. + // tanh(x + i * y) = (tanh(x) + i * tan(y)) / (1 + tanh(x) * tan(y)) + // See: https://proofwiki.org/wiki/Hyperbolic_Tangent_of_Complex_Number Value real = rewriter.create(loc, elementType, adaptor.getComplex()); Value imag =