约 1157 字

约 6 分钟

#C 语言标准库函数 tanhd128

#include <math.h>

_Decimal128 tanhd128(_Decimal128 x);

说明

计算实数的双曲正切。

有限实数的数学结果在 (-1, 1) 内,大参数舍入后可能达到端点。

自 C23 起提供。需要实现定义 __STDC_IEC_60559_DFP__ 并提供对应的十进制浮点接口。

参数

  • x - 参与运算的实浮点值。

返回值

  • 返回双曲正切的实数值。

#示例

使用 GCC 时,在链接命令末尾添加 -lm。

#include <math.h>
#include <stdio.h>

int main(void)
{
    printf("%.9Lg\n", (long double)tanhd128(1.0dl));
    return 0;
}

#相关接口

#参考标准

更新: 2026/11/28

作者: planc

创建: 2026/11/28