1tgamma(3M) Mathematical Library Functions tgamma(3M)
2
3
4
6 tgamma, tgammaf, tgammal - compute gamma function
7
9 c99 [ flag... ] file... -lm [ library... ]
10 #include <math.h>
11
12 double tgamma(double x);
13
14
15 float tgammaf(float x);
16
17
18 long double tgammal(long double x);
19
20
22 These functions compute the gamma() function of x.
23
25 Upon successful completion, these functions return gamma(x).
26
27
28 If x is a negative integer, a domain error occurs and a NaN is
29 returned.
30
31
32 If the correct value would cause overflow, a range error occurs and
33 tgamma(), tgammaf(), and tgammal() return the value of the macro
34 ±HUGE_VAL, ±HUGE_VALF, or ±HUGE_VALL, respectively.
35
36
37 If x is NaN, a NaN is returned.
38
39
40 If x is ±Inf, x is returned.
41
42
43 If x is ±0, a pole error occurs and tgamma(), tgammaf(), and tgammal()
44 return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL, respectively.
45
46
47 If x is +Inf, a domain error occurs and a NaN is returned.
48
50 These functions will fail if:
51
52 Domain Error The value of x is a negative integer or x is −Inf.
53
54 If the integer expression (math_errhandling &
55 MATH_ERREXCEPT) is non-zero, then the invalid floating-
56 point exception is raised.
57
58
59 Pole Error The value of x is zero.
60
61 If the integer expression (math_errhandling &
62 MATH_ERREXCEPT) is non-zero, then the divide-by-zero
63 floating-point exception is raised.
64
65
66 Range Error The value overflows.
67
68 If the integer expression (math_errhandling &
69 MATH_ERREXCEPT) is non-zero, then the overflow float‐
70 ing-point exception is raised.
71
72
74 An application wanting to check for exceptions should call feclearex‐
75 cept(FE_ALL_EXCEPT) before calling these functions. On return, if
76 fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
77 non-zero, an exception has been raised. An application should either
78 examine the return value or check the floating point exception flags to
79 detect exceptions.
80
82 See attributes(5) for descriptions of the following attributes:
83
84
85
86
87 ┌─────────────────────────────┬─────────────────────────────┐
88 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
89 ├─────────────────────────────┼─────────────────────────────┤
90 │Interface Stability │Standard │
91 ├─────────────────────────────┼─────────────────────────────┤
92 │MT-Level │MT-Safe │
93 └─────────────────────────────┴─────────────────────────────┘
94
96 feclearexcept(3M), fetestexcept(3M), lgamma(3M), math.h(3HEAD),
97 attributes(5), standards(5)
98
99
100
101SunOS 5.11 12 Jul 2006 tgamma(3M)