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

lgamma.3p (4482B)


  1. '\" et
  2. .TH LGAMMA "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. lgamma,
  15. lgammaf,
  16. lgammal,
  17. signgam
  18. \(em log gamma function
  19. .SH SYNOPSIS
  20. .LP
  21. .nf
  22. #include <math.h>
  23. .P
  24. double lgamma(double \fIx\fP);
  25. float lgammaf(float \fIx\fP);
  26. long double lgammal(long double \fIx\fP);
  27. extern int signgam;
  28. .fi
  29. .SH DESCRIPTION
  30. The functionality described on this reference page is aligned with the
  31. ISO\ C standard. Any conflict between the requirements described here and the
  32. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  33. .P
  34. These functions shall compute
  35. $log_ e" " \(br \(*G ( ^ x ) \(br$
  36. where $\(*G ( ^ x )$ is defined as
  37. $int from 0 to inf e"^" " "{ - t } t"^" " "{ x - 1 } dt$.
  38. The argument
  39. .IR x
  40. need not be a non-positive integer ($\(*G( ^ x )$ is defined over
  41. the reals, except the non-positive integers).
  42. .P
  43. If
  44. .IR x
  45. is NaN, \-Inf, or a negative integer, the value of
  46. .IR signgam
  47. is unspecified.
  48. .P
  49. These functions need not be thread-safe.
  50. .P
  51. An application wishing to check for error situations should set
  52. .IR errno
  53. to zero and call
  54. .IR feclearexcept (FE_ALL_EXCEPT)
  55. before calling these functions. On return, if
  56. .IR errno
  57. is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO |
  58. FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred.
  59. .SH "RETURN VALUE"
  60. Upon successful completion, these functions shall return the
  61. logarithmic gamma of
  62. .IR x .
  63. .P
  64. If
  65. .IR x
  66. is a non-positive integer, a pole error shall occur and
  67. \fIlgamma\fR(),
  68. \fIlgammaf\fR(),
  69. and
  70. \fIlgammal\fR()
  71. shall return +HUGE_VAL, +HUGE_VALF, and +HUGE_VALL, respectively.
  72. .P
  73. If the correct value would cause overflow, a range error shall occur
  74. and
  75. \fIlgamma\fR(),
  76. \fIlgammaf\fR(),
  77. and
  78. \fIlgammal\fR()
  79. shall return \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL (having the
  80. same sign as the correct value), respectively.
  81. .P
  82. If
  83. .IR x
  84. is NaN, a NaN shall be returned.
  85. .P
  86. If
  87. .IR x
  88. is 1 or 2, +0 shall be returned.
  89. .P
  90. If
  91. .IR x
  92. is \(+-Inf, +Inf shall be returned.
  93. .SH ERRORS
  94. These functions shall fail if:
  95. .IP "Pole\ Error" 12
  96. The
  97. .IR x
  98. argument is a negative integer or zero.
  99. .RS 12
  100. .P
  101. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  102. non-zero, then
  103. .IR errno
  104. shall be set to
  105. .BR [ERANGE] .
  106. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  107. non-zero, then the divide-by-zero floating-point exception shall be
  108. raised.
  109. .RE
  110. .IP "Range\ Error" 12
  111. The result overflows.
  112. .RS 12
  113. .P
  114. If the integer expression (\fImath_errhandling\fR & MATH_ERRNO) is
  115. non-zero, then
  116. .IR errno
  117. shall be set to
  118. .BR [ERANGE] .
  119. If the integer expression (\fImath_errhandling\fR & MATH_ERREXCEPT) is
  120. non-zero, then the overflow floating-point exception shall be raised.
  121. .RE
  122. .LP
  123. .IR "The following sections are informative."
  124. .SH EXAMPLES
  125. None.
  126. .SH "APPLICATION USAGE"
  127. On error, the expressions (\fImath_errhandling\fR & MATH_ERRNO) and
  128. (\fImath_errhandling\fR & MATH_ERREXCEPT) are independent of each
  129. other, but at least one of them must be non-zero.
  130. .SH RATIONALE
  131. None.
  132. .SH "FUTURE DIRECTIONS"
  133. None.
  134. .SH "SEE ALSO"
  135. .IR "\fIexp\fR\^(\|)",
  136. .IR "\fIfeclearexcept\fR\^(\|)",
  137. .IR "\fIfetestexcept\fR\^(\|)",
  138. .IR "\fIisnan\fR\^(\|)"
  139. .P
  140. The Base Definitions volume of POSIX.1\(hy2017,
  141. .IR "Section 4.20" ", " "Treatment of Error Conditions for Mathematical Functions",
  142. .IR "\fB<math.h>\fP"
  143. .\"
  144. .SH COPYRIGHT
  145. Portions of this text are reprinted and reproduced in electronic form
  146. from IEEE Std 1003.1-2017, Standard for Information Technology
  147. -- Portable Operating System Interface (POSIX), The Open Group Base
  148. Specifications Issue 7, 2018 Edition,
  149. Copyright (C) 2018 by the Institute of
  150. Electrical and Electronics Engineers, Inc and The Open Group.
  151. In the event of any discrepancy between this version and the original IEEE and
  152. The Open Group Standard, the original IEEE and The Open Group Standard
  153. is the referee document. The original Standard can be obtained online at
  154. http://www.opengroup.org/unix/online.html .
  155. .PP
  156. Any typographical or formatting errors that appear
  157. in this page are most likely
  158. to have been introduced during the conversion of the source files to
  159. man page format. To report such errors, see
  160. https://www.kernel.org/doc/man-pages/reporting_bugs.html .