EN
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助
鲲鹏小智

lgamma_r

计算x的伽马值绝对值的自然对数,返回伽马值的符号,输入参数为实数。

接口定义

C interface:

float lgammaf(float x);

double lgamma(double x);

参数

参数名

类型

描述

输入/输出

x

  • 在lgammaf中,x是单精度浮点类型。
  • 在lgamma中,x是双精度浮点类型。

表示输入数据的浮点值。

输入

返回值

  • 返回入参x的伽马值绝对值的自然对数、伽马值的符号。
  • 输入nan,返回nan,符号为1。
  • 输入+∞,返回+∞,符号为1。
  • 输入-∞,返回+∞,符号为1。
  • 输入+0,返回+∞,符号为1。
  • 输入-0,返回+∞,符号为-1。

依赖

C: "km.h"

示例

C interface:
    // print result
    int sign=0;
    double res=0.0;
    res=lgamma_r(0.0, &sign);
    printf("lgamma_r(0.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-0.0, &sign);
    printf("lgamma_r(-0.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(0.25, &sign);
    printf("lgamma_r(0.25, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-0.25, &sign);
    printf("lgamma_r(-0.25, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(0.5, &sign);
    printf("lgamma_r(0.5, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-0.5, &sign);
    printf("lgamma_r(-0.5, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(1.0, &sign);
    printf("lgamma_r(1.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-1.0, &sign);
    printf("lgamma_r(-1.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(2.0, &sign);
    printf("lgamma_r(2.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-2.0, &sign);
    printf("lgamma_r(-2.0, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(INFINITY, &sign);
    printf("lgamma_r(INFINITY, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-INFINITY, &sign);
    printf("lgamma_r(-INFINITY, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(NAN, &sign);
    printf("lgamma_r(NAN, &sign) = %.15f, sign = %d\n", res, sign);
    res=lgamma_r(-NAN, &sign);
    printf("lgamma_r(-NAN, &sign) = %.15f, sign = %d\n", res, sign);
    /* 
     * lgamma_r(0.0, &sign) = inf, sign = 1
     * lgamma_r(-0.0, &sign) = inf, sign = -1
     * lgamma_r(0.25, &sign) = 1.288022524698077, sign = 1
     * lgamma_r(-0.25, &sign) = 1.589575312551186, sign = -1
     * lgamma_r(0.5, &sign) = 0.572364942924700, sign = 1
     * lgamma_r(-0.5, &sign) = 1.265512123484645, sign = -1
     * lgamma_r(1.0, &sign) = 0.000000000000000, sign = 1
     * lgamma_r(-1.0, &sign) = inf, sign = 1
     * lgamma_r(2.0, &sign) = 0.000000000000000, sign = 1
     * lgamma_r(-2.0, &sign) = inf, sign = 1
     * lgamma_r(INFINITY, &sign) = inf, sign = 1
     * lgamma_r(-INFINITY, &sign) = inf, sign = 1
     * lgamma_r(NAN, &sign) = nan, sign = 1
     * lgamma_r(-NAN, &sign) = -nan, sign = 1
     * 
     * */
搜索结果
找到“0”个结果

当前产品无相关内容

未找到相关内容,请尝试其他搜索词