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

NAME

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

SYNOPSIS

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

DESCRIPTION

22       The functionality described on this reference page is aligned with  the
23       ISO C  standard.  Any  conflict between the requirements described here
24       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2017
25       defers to the ISO C standard.
26
27       These  functions  shall  compute Γ(x) where Γ(x) is defined as ∞0∫e^tt^
28       x−1dt.
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 the  gamma  of
38       x.
39
40       If  x  is a negative integer, a domain error may occur and either a NaN
41       (if supported) or an implementation-defined value  shall  be  returned.
42       On  systems  that support the IEC 60559 Floating-Point option, a domain
43       error shall occur and a NaN shall be returned.
44
45       If x is ±0, tgamma(), tgammaf(), and tgammal() shall return  ±HUGE_VAL,
46       ±HUGE_VALF,  and ±HUGE_VALL, respectively.  On systems that support the
47       IEC 60559 Floating-Point option, a pole error shall occur; otherwise, a
48       pole error may occur.
49
50       If  the  correct  value would cause overflow, a range error shall occur
51       and  tgamma(),  tgammaf(),  and  tgammal()  shall   return   ±HUGE_VAL,
52       ±HUGE_VALF, or ±HUGE_VALL, respectively, with the same sign as the cor‐
53       rect value of the function.
54
55       If the correct value would cause underflow, and is not representable, a
56       range  error  may  occur,  and tgamma(), tgammaf(), and tgammal() shall
57       return 0.0, or (if IEC 60559 Floating-Point is not supported) an imple‐
58       mentation-defined  value no greater in magnitude than DBL_MIN, FLT_MIN,
59       and LDBL_MIN, respectively.
60
61       If the correct value would cause underflow,  and  is  representable,  a
62       range error may occur and the correct value shall be returned.
63
64       If x is subnormal and 1/x is representable, 1/x should be returned.
65
66       If x is NaN, a NaN shall be returned.
67
68       If x is +Inf, x shall be returned.
69
70       If x is -Inf, a domain error shall occur, and a NaN shall be returned.
71

ERRORS

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

EXAMPLES

130       None.
131

APPLICATION USAGE

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‐2017, Section 4.20, 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-2017, Standard for Information Technology -- Por‐
154       table Operating System Interface (POSIX), The Open Group Base  Specifi‐
155       cations  Issue  7, 2018 Edition, Copyright (C) 2018 by the Institute of
156       Electrical and Electronics Engineers, Inc and The Open Group.   In  the
157       event of any discrepancy between this version and the original IEEE and
158       The Open Group Standard, the original IEEE and The Open Group  Standard
159       is  the  referee document. The original Standard can be obtained online
160       at http://www.opengroup.org/unix/online.html .
161
162       Any typographical or formatting errors that appear  in  this  page  are
163       most likely to have been introduced during the conversion of the source
164       files to man page format. To report such errors,  see  https://www.ker
165       nel.org/doc/man-pages/reporting_bugs.html .
166
167
168
169IEEE/The Open Group                  2017                           TGAMMA(3P)
Impressum