logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

tgamma.3p (6711B)


  1. '\" et
  2. .TH TGAMMA "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .EQ
  11. delim $$
  12. .EN
  13. .SH NAME
  14. tgamma,
  15. tgammaf,
  16. tgammal
  17. \(em compute gamma(\|) function
  18. .SH SYNOPSIS
  19. .LP
  20. .nf
  21. #include <math.h>
  22. .P
  23. double tgamma(double \fIx\fP);
  24. float tgammaf(float \fIx\fP);
  25. long double tgammal(long double \fIx\fP);
  26. .fi
  27. .SH DESCRIPTION
  28. The functionality described on this reference page is aligned with the
  29. ISO\ C standard. Any conflict between the requirements described here and the
  30. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  31. .P
  32. These functions shall compute $\(*G ( ^ x )$
  33. where $\(*G ( ^ x )$ is defined as
  34. $int from 0 to inf e"^" " "{ - t } t"^" " "{ x - 1 } dt$.
  35. .P
  36. An application wishing to check for error situations should set
  37. .IR errno
  38. to zero and call
  39. .IR feclearexcept (FE_ALL_EXCEPT)
  40. before calling these functions. On return, if
  41. .IR errno
  42. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  43. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  44. .SH "RETURN VALUE"
  45. Upon successful completion, these functions shall return the gamma of
  46. .IR x .
  47. .P
  48. If
  49. .IR x
  50. is a negative integer, a
  51. domain
  52. error may occur and either a NaN (if supported) or an
  53. implementation-defined value shall be returned.
  54. On systems that support the IEC 60559 Floating-Point option, a domain
  55. error shall occur and a NaN shall be returned.
  56. .P
  57. If
  58. .IR x
  59. is \(+-0,
  60. \fItgamma\fR(),
  61. \fItgammaf\fR(),
  62. and
  63. \fItgammal\fR()
  64. shall return \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL,
  65. respectively.
  66. On systems that support the IEC 60559 Floating-Point option, a pole
  67. error shall occur;
  68. otherwise, a
  69. pole
  70. error may occur.
  71. .P
  72. If the correct value would cause overflow, a range error shall occur
  73. and
  74. \fItgamma\fR(),
  75. \fItgammaf\fR(),
  76. and
  77. \fItgammal\fR()
  78. shall return \(+-HUGE_VAL, \(+-HUGE_VALF, or \(+-HUGE_VALL,
  79. respectively, with the same sign as the correct value of the function.
  80. .P
  81. If the correct value would cause underflow,
  82. and is not representable,
  83. a range error may occur, and
  84. \fItgamma\fR(),
  85. \fItgammaf\fR(),
  86. and
  87. \fItgammal\fR()
  88. shall return
  89. 0.0, or
  90. (if IEC 60559 Floating-Point is not supported) an implementation-defined
  91. value no greater in magnitude than DBL_MIN, FLT_MIN, and LDBL_MIN,
  92. respectively.
  93. .P
  94. If the correct value would cause underflow, and is representable,
  95. a range error may occur and the correct value shall be returned.
  96. .P
  97. If
  98. .IR x
  99. is subnormal and 1/\c
  100. .IR x
  101. is representable, 1/\c
  102. .IR x
  103. should be returned.
  104. .P
  105. If
  106. .IR x
  107. is NaN, a NaN shall be returned.
  108. .P
  109. If
  110. .IR x
  111. is +Inf,
  112. .IR x
  113. shall be returned.
  114. .P
  115. If
  116. .IR x
  117. is \-Inf, a domain error shall occur, and a NaN shall be returned.
  118. .SH ERRORS
  119. These functions shall fail if:
  120. .IP "Domain\ Error" 12
  121. The value of
  122. .IR x
  123. is a negative integer, or
  124. .IR x
  125. is \-Inf.
  126. .RS 12
  127. .P
  128. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  129. non-zero, then
  130. .IR errno
  131. shall be set to
  132. .BR [EDOM] .
  133. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  134. non-zero, then the invalid floating-point exception shall be raised.
  135. .RE
  136. .IP "Pole\ Error" 12
  137. The value of
  138. .IR x
  139. is zero.
  140. .RS 12
  141. .P
  142. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  143. non-zero, then
  144. .IR errno
  145. shall be set to
  146. .BR [ERANGE] .
  147. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  148. non-zero, then the divide-by-zero floating-point exception shall be
  149. raised.
  150. .br
  151. .RE
  152. .IP "Range\ Error" 12
  153. The value overflows.
  154. .RS 12
  155. .P
  156. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  157. non-zero, then
  158. .IR errno
  159. shall be set to
  160. .BR [ERANGE] .
  161. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  162. non-zero, then the overflow floating-point exception shall be raised.
  163. .RE
  164. .P
  165. These functions may fail if:
  166. .IP "Domain\ Error" 12
  167. The value of
  168. .IR x
  169. is a negative integer.
  170. .RS 12
  171. .P
  172. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  173. non-zero, then
  174. .IR errno
  175. shall be set to
  176. .BR [EDOM] .
  177. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  178. non-zero, then the invalid floating-point exception shall be raised.
  179. .RE
  180. .IP "Pole\ Error" 12
  181. The value of
  182. .IR x
  183. is zero.
  184. .RS 12
  185. .P
  186. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  187. non-zero, then
  188. .IR errno
  189. shall be set to
  190. .BR [ERANGE] .
  191. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  192. non-zero, then the divide-by-zero floating-point exception shall be
  193. raised.
  194. .RE
  195. .IP "Range\ Error" 12
  196. The result underflows.
  197. .RS 12
  198. .P
  199. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  200. non-zero, then
  201. .IR errno
  202. shall be set to
  203. .BR [ERANGE] .
  204. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT)
  205. is non-zero, then the underflow floating-point exception shall be raised.
  206. .RE
  207. .LP
  208. .IR "The following sections are informative."
  209. .SH EXAMPLES
  210. None.
  211. .SH "APPLICATION USAGE"
  212. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  213. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  214. other, but at least one of them must be non-zero.
  215. .SH RATIONALE
  216. This function is named
  217. \fItgamma\fR()
  218. in order to avoid conflicts with the historical
  219. .IR gamma (\|)
  220. and
  221. \fIlgamma\fR()
  222. functions.
  223. .SH "FUTURE DIRECTIONS"
  224. It is possible that the error response for a negative integer argument
  225. may be changed to a pole error and a return value of \(+-Inf.
  226. .SH "SEE ALSO"
  227. .IR "\fIfeclearexcept\fR\^(\|)",
  228. .IR "\fIfetestexcept\fR\^(\|)",
  229. .IR "\fIlgamma\fR\^(\|)"
  230. .P
  231. The Base Definitions volume of POSIX.1\(hy2017,
  232. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  233. .IR "\fB<math.h>\fP"
  234. .\"
  235. .SH COPYRIGHT
  236. Portions of this text are reprinted and reproduced in electronic form
  237. from IEEE Std 1003.1-2017, Standard for Information Technology
  238. -- Portable Operating System Interface (POSIX), The Open Group Base
  239. Specifications Issue 7, 2018 Edition,
  240. Copyright (C) 2018 by the Institute of
  241. Electrical and Electronics Engineers, Inc and The Open Group.
  242. In the event of any discrepancy between this version and the original IEEE and
  243. The Open Group Standard, the original IEEE and The Open Group Standard
  244. is the referee document. The original Standard can be obtained online at
  245. http://www.opengroup.org/unix/online.html .
  246. .PP
  247. Any typographical or formatting errors that appear
  248. in this page are most likely
  249. to have been introduced during the conversion of the source files to
  250. man page format. To report such errors, see
  251. https://www.kernel.org/doc/man-pages/reporting_bugs.html .