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
21

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

85       None.
86

APPLICATION USAGE

88       For  IEEE Std 754-1985 double, overflow happens when 0 < x < 1/DBL_MAX,
89       and 171.7 < x.
90
91       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
92       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
93       at least one of them must be non-zero.
94

RATIONALE

96       This function is named tgamma() in order to avoid  conflicts  with  the
97       historical gamma() and lgamma() functions.
98

FUTURE DIRECTIONS

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

SEE ALSO

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