1TGAMMA(P)                  POSIX Programmer's Manual                 TGAMMA(P)
2
3
4

NAME

6       tgamma, tgammaf, tgammal - compute gamma() function
7

SYNOPSIS

9       #include <math.h>
10
11       double tgamma(double x);
12       float tgammaf(float x);
13       long double tgammal(long double x);
14
15

DESCRIPTION

17       These functions shall compute the gamma() function of x.
18
19       An  application  wishing to check for error situations should set errno
20       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
21       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
22       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
23       occurred.
24

RETURN VALUE

26       Upon successful completion, these functions shall return Gamma( x).
27
28       If  x  is  a negative integer, a domain error shall occur, and either a
29       NaN  (if  supported),  or  an  implementation-defined  value  shall  be
30       returned.
31
32       If  the  correct  value would cause overflow, a range error shall occur
33       and  tgamma(),  tgammaf(),  and  tgammal()  shall   return   ±HUGE_VAL,
34       ±HUGE_VALF, or ±HUGE_VALL, respectively, with the same sign as the cor‐
35       rect value of the function.
36
37       If x is NaN, a NaN shall be returned.
38
39       If x is +Inf, x shall be returned.
40
41       If x is ±0, a pole error shall  occur,  and  tgamma(),  tgammaf(),  and
42       tgammal()  shall  return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL, respec‐
43       tively.
44
45       If x is -Inf, a domain error shall occur, and either  a  NaN  (if  sup‐
46       ported), or an implementation-defined value shall be returned.
47

ERRORS

49       These functions shall fail if:
50
51       Domain Error
52              The value of x is a negative integer,    or x is -Inf.
53
54       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
55       then  errno  shall  be  set  to  [EDOM].  If  the  integer   expression
56       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then  the invalid
57       floating-point exception shall be raised.
58
59       Pole Error
60              The value of x is zero.
61
62       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
63       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
64       (math_errhandling & MATH_ERREXCEPT) is non-zero,  then  the  divide-by-
65       zero floating-point exception shall be raised.
66
67       Range Error
68              The value overflows.
69
70       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
71       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
72       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then the overflow
73       floating-point exception shall be raised.
74
75
76       The following sections are informative.
77

EXAMPLES

79       None.
80

APPLICATION USAGE

82       For IEEE Std 754-1985 double, overflow happens when 0 < x <  1/DBL_MAX,
83       and 171.7 < x.
84
85       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
86       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
87       at least one of them must be non-zero.
88

RATIONALE

90       This  function  is  named tgamma() in order to avoid conflicts with the
91       historical gamma() and lgamma() functions.
92

FUTURE DIRECTIONS

94       It is possible that the error response for a negative integer  argument
95       may be changed to a pole error and a return value of ±Inf.
96

SEE ALSO

98       feclearexcept() , fetestexcept() , lgamma() , the Base Definitions vol‐
99       ume of IEEE Std 1003.1-2001, Section 4.18, Treatment  of  Error  Condi‐
100       tions for Mathematical Functions, <math.h>
101
103       Portions  of  this text are reprinted and reproduced in electronic form
104       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
105       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
106       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
107       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
108       event of any discrepancy between this version and the original IEEE and
109       The  Open Group Standard, the original IEEE and The Open Group Standard
110       is the referee document. The original Standard can be  obtained  online
111       at http://www.opengroup.org/unix/online.html .
112
113
114
115IEEE/The Open Group                  2003                            TGAMMA(P)
Impressum