code: def tanh(expr):
      expr = ast.IdExpr(expr, to_reuse=True)
      tanh_expr = utils.sub(
          ast.NumVal(1.0),
          utils.div(
              ast.NumVal(2.0),
              utils.add(
                  ast.ExpExpr(utils.mul(ast.NumVal(2.0), expr)),
                  ast.NumVal(1.0),
              ),
          ),
      )
      return ast.IfExpr(
          utils.gt(expr, ast.NumVal(44.0)),  # exp(2*x) <= 2^127
          ast.NumVal(1.0),
          ast.IfExpr(
              utils.lt(expr, ast.NumVal(-44.0)),
              ast.NumVal(-1.0),
              tanh_expr,
          ),
      )
  
file_path: m2cgen/m2cgen/assemblers/fallback_expressions.py
imports: import math
  from m2cgen import ast
  from m2cgen.assemblers import utils
label_desc: Use image node_id 2 for calling a global function with example usage: tanh(expr) and returns: ast