约 1081 字

约 5 分钟

#C 语言标准库函数 tgammad32

#include <math.h>

_Decimal32 tgammad32(_Decimal32 x);

说明

计算伽马函数。

正整数 n 的结果是 (n - 1) 的阶乘。负整数会导致定义域错误或极点错误,零可能导致极点错误。

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

参数

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

返回值

  • 返回伽马函数的值。

#示例

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

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

int main(void)
{
    printf("%.9Lg\n", (long double)tgammad32(5.0df));
    return 0;
}

#相关接口

#参考标准

更新: 2026/11/28

作者: planc

创建: 2026/11/28