---
title: catanh
description: "计算复数的双曲反正切值。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0275.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0275.html
indexId: 561b4aa9a4f543d2efd8c0efb4fcd03c29873ba76c0fcf0a7bb2627f78f9b6fa61
---
# catanh

计算复数的双曲反正切值。

#### 接口定义

C interface：

float complex catanhf(float complex x);

double complex catanh(double complex x);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| x | 在catanhf中，x是复数单精度浮点类型。 在catanh中，x是复数双精度浮点类型。 | 表示输入数据的浮点值。 | 输入 |


#### 返回值

- 返回x的双曲反正切结果y。
- 特殊值说明如下所示。| 输入值实部（x.real） | 输入值虚部（x.imag） | 输出值实部（y.real） | 输出值虚部（y.imag） |
| --- | --- | --- | --- |
| inf | / | +0.0 | / |
| \-inf | / | \-0.0 | / |
| +0.0 | nan | +0.0 | nan |
| nan | ±inf | +0.0 | / |
| nan | 非±inf | nan | nan |


#### 依赖

C: "km.h"


#### 示例

C interface：```
// typical usage
    double x1 = 1.0, x2 = 2.0, x3 = 3.0, x4 = 4.0;
    double complex cx1 = __builtin_complex(x1, x2);
    double complex cx2 = __builtin_complex(x3, x4);
    double complex cx3 = __builtin_complex(NAN, NAN);
    double complex cx4 = __builtin_complex(INFINITY, -INFINITY);

    // print result
    double ry;
    double iy;
    ry = __real__ catanh(cx1);
    iy = __imag__ catanh(cx1);
    printf("catanh(cx1) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx2);
    iy = __imag__ catanh(cx2);
    printf("catanh(cx2) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx3);
    iy = __imag__ catanh(cx3);
    printf("catanh(cx3) = %.15f, %.15f\n", ry, iy);
    ry = __real__ catanh(cx4);
    iy = __imag__ catanh(cx4);
    printf("catanh(cx4) = %.15f, %.15f\n", ry, iy);

result:
   /*
    * catanh(cx1) = 0.173286795139986, 1.178097245096172
    * catanh(cx2) = 0.117500907311434, 1.409921049596575
    * catanh(cx3) = nan, nan
    * catanh(cx4) = 0.000000000000000, -1.570796326794897
    */
```
