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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       tgamma, tgammaf, tgammal — compute gamma() function
14

SYNOPSIS

16       #include <math.h>
17
18       double tgamma(double x);
19       float tgammaf(float x);
20       long double tgammal(long double x);
21

DESCRIPTION

23       The functionality described on this reference page is aligned with  the
24       ISO C  standard.  Any  conflict between the requirements described here
25       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
26       defers to the ISO C standard.
27
28       These functions shall compute the gamma function of x.
29
30       An  application  wishing to check for error situations should set errno
31       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
32       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
33       FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero,  an  error  has
34       occurred.
35

RETURN VALUE

37       Upon successful completion, these functions shall return Gamma(x).
38
39       If  x  is a negative integer, a domain error may occur and either a NaN
40       (if supported) or an implementation-defined value  shall  be  returned.
41       On  systems  that support the IEC 60559 Floating-Point option, a domain
42       error shall occur and a NaN shall be returned.
43
44       If x is ±0, tgamma(), tgammaf(), and tgammal() shall return  ±HUGE_VAL,
45       ±HUGE_VALF,  and ±HUGE_VALL, respectively.  On systems that support the
46       IEC 60559 Floating-Point option, a pole error shall occur; otherwise, a
47       pole error may occur.
48
49       If  the  correct  value would cause overflow, a range error shall occur
50       and  tgamma(),  tgammaf(),  and  tgammal()  shall   return   ±HUGE_VAL,
51       ±HUGE_VALF, or ±HUGE_VALL, respectively, with the same sign as the cor‐
52       rect value of the function.
53
54       If the correct value would cause underflow, and is not representable, a
55       range  error  may  occur,  and tgamma(), tgammaf(), and tgammal() shall
56       return 0.0, or (if IEC 60559 Floating-Point is not supported) an imple‐
57       mentation-defined  value no greater in magnitude than DBL_MIN, FLT_MIN,
58       and LDBL_MIN, respectively.
59
60       If the correct value would cause underflow,  and  is  representable,  a
61       range error may occur and the correct value shall be returned.
62
63       If x is NaN, a NaN shall be returned.
64
65       If x is +Inf, x shall be returned.
66
67       If x is −Inf, a domain error shall occur, and a NaN shall be returned.
68

ERRORS

70       These functions shall fail if:
71
72       Domain Error
73                   The value of x is a negative integer, or x is −Inf.
74
75                   If  the  integer expression (math_errhandling & MATH_ERRNO)
76                   is non-zero, then errno shall be set  to  [EDOM].   If  the
77                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
78                   non-zero, then the invalid floating-point  exception  shall
79                   be raised.
80
81       Pole Error  The value of x is zero.
82
83                   If  the  integer expression (math_errhandling & MATH_ERRNO)
84                   is non-zero, then errno shall be set to [ERANGE].   If  the
85                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
86                   non-zero, then the divide-by-zero floating-point  exception
87                   shall be raised.
88
89       Range Error The value overflows.
90
91                   If  the  integer expression (math_errhandling & MATH_ERRNO)
92                   is non-zero, then errno shall be set to [ERANGE].   If  the
93                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
94                   non-zero, then the overflow floating-point exception  shall
95                   be raised.
96
97       These functions may fail if:
98
99       Domain Error
100                   The value of x is a negative integer.
101
102                   If  the  integer expression (math_errhandling & MATH_ERRNO)
103                   is non-zero, then errno shall be set  to  [EDOM].   If  the
104                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
105                   non-zero, then the invalid floating-point  exception  shall
106                   be raised.
107
108       Pole Error  The value of x is zero.
109
110                   If  the  integer expression (math_errhandling & MATH_ERRNO)
111                   is non-zero, then errno shall be set to [ERANGE].   If  the
112                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
113                   non-zero, then the divide-by-zero floating-point  exception
114                   shall be raised.
115
116       Range Error The result underflows.
117
118                   If  the  integer expression (math_errhandling & MATH_ERRNO)
119                   is non-zero, then errno shall be set to [ERANGE].   If  the
120                   integer  expression  (math_errhandling & MATH_ERREXCEPT) is
121                   non-zero, then the underflow floating-point exception shall
122                   be raised.
123
124       The following sections are informative.
125

EXAMPLES

127       None.
128

APPLICATION USAGE

130       For  IEEE Std 754‐1985 double, overflow happens when 0 < x < 1/DBL_MAX,
131       and 171.7 < x.
132
133       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
134       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
135       at least one of them must be non-zero.
136

RATIONALE

138       This function is named tgamma() in order to avoid  conflicts  with  the
139       historical gamma() and lgamma() functions.
140

FUTURE DIRECTIONS

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

SEE ALSO

146       feclearexcept(), fetestexcept(), lgamma()
147
148       The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
149       Error Conditions for Mathematical Functions, <math.h>
150
152       Portions  of  this text are reprinted and reproduced in electronic form
153       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
154       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
155       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
156       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
157       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
158       event of any discrepancy between this version and the original IEEE and
159       The Open Group Standard, the original IEEE and The Open Group  Standard
160       is  the  referee document. The original Standard can be obtained online
161       at http://www.unix.org/online.html .
162
163       Any typographical or formatting errors that appear  in  this  page  are
164       most likely to have been introduced during the conversion of the source
165       files to man page format. To report such errors,  see  https://www.ker
166       nel.org/doc/man-pages/reporting_bugs.html .
167
168
169
170IEEE/The Open Group                  2013                           TGAMMA(3P)
Impressum