我要评分
获取效率
正确性
完整性
易理解

tgamma

Return the gamma of the input parameter x, that is, .

Interface Definition

C interface:

float tgammaf(float x);

float tgammaf_18(float x); // Provided only in high-precision function interfaces.

Parameters

Parameter

Type

Description

Input/Output

x

  • For tgammaf, x is of single-precision floating-point type.
  • For tgammaf_18, x is of single-precision floating-point type.

Floating-point value of the input data

Input

Return Value

The gamma y of x is returned. y ∈ (-INF, +INF).

  • If the input x is ±0, the return value is ±INF.
  • If the input x is a negative integer, the return value is -NaN.
  • If the input x is NaN, the return value is NaN.
  • If the input x is +INF, the return value is +INF.
  • If the input x is -INF, the return value is -NAN.

Dependencies

C: "km.h"

Examples

C interface:
 // typical usage 
    float x1 = -2.5, x2 = -1.5, x3 = 1.5, x4 = 2.5; 
    // special handing 
    float a = -2.0, b = -0.0, c = INFINITY, d = NAN; 
    // print result 
        printf("tgammaf(-2.5) = %.15f\n", tgammaf(x1)); 
        printf("tgammaf(-1.5) = %.15f\n", tgammaf(x2)); 
        printf("tgammaf(1.5) = %.15f\n", tgammaf(x3)); 
        printf("tgammaf(2.5) = %.15f\n", tgammaf(x4)); 
        printf("tgammaf(-2.0) = %.15f\n", tgammaf(a)); 
        printf("tgammaf(-0.0) = %.15f\n", tgammaf(b)); 
        printf("tgammaf(INFINITY) = %.15f\n", tgammaf(c)); 
        printf("tgammaf(NAN) = %.15f\n", tgammaf(d)); 
    /* 
     *  
     *  tgammaf(-2.5) = -0.945308744907379
     *  tgammaf(-1.5) = 2.363271713256836
     *  tgammaf(1.5) = 0.886226952075958
     *  tgammaf(2.5) = 1.329340338706970
     *  tgammaf(-2.0) = -nan
     *  tgammaf(-0.0) = -inf
     *  tgammaf(INFINITY) = inf
     *  tgammaf(NAN) = nan
     *
     * */