当前位置: C语言 -- 标准库 -- <math.h> -- lgammaf

lgammaf函数


概要:
#include <math.h>
float lgammaf(float x);

描述:

该函数计算参数x伽玛绝对值的自然对数。

如果参数x是正值且太大,将发生范围错误(range error)

如果参数x为负整数或者0,将可能发生极点错误。


参数:
float x

参数为一个float类型的浮点数。


返回值:

函数返回loge|Γ(x)|的值。


范例:
1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
/*函数lgammaf范例*/

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

int main(void)
{
    float x = 9.0f;
    float y;

    y = lgammaf(x);
    printf("The natural logarithm of the absolute value of gamma of %.6f is %.6f.\n", x, y);

    return 0;
}

输出:

The natural logarithm of the absolute value of gamma of 9.000000 is 10.604603.


相关内容:
lgamma 计算double类型参数伽玛绝对值的自然对数的函数。
lgammal 计算long double类型参数伽玛绝对值的自然对数的函数。