tgamma
Return the gamma value of the input parameter x, that is,
.
Interface Definition
C interface:
float tgammaf(float x);
float tgammaf_18(float x);double tgamma(double x);
double tgamma(double x);
tgammaf_18 is provided only in the high-precision version.
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
x |
|
Floating-point value of the input data. |
Input |
Return Value
- The gamma value 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | // typical usage float x1 = -2.5, x2 = -1.5, x3 = 1.5, x4 = 2.5; // special handling 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 * * */ |
Parent topic: Special Functions