.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) .\" Distributed under GPL .\" Based on glibc infopages .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk .\" .\" Modified 2004-11-15, fixed error noted by Fabian Kreutz .\" .\" .\" Japanese Version Copyright (c) 2002 Akihiro MOTOKI .\" all rights reserved. .\" Translated Sun Sep 22 09:31:52 2002 .\" by Akihiro MOTOKI .\" Updated & Modified Sat Feb 12 12:00:00 2005 .\" by SAITOH Akira .\" Updated 2008-09-16, Akihiro MOTOKI .\" .TH TGAMMA 3 2010-09-20 "GNU" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O tgamma, tgammaf, tgammal \- true gamma function tgamma, tgammaf, tgammal \- 本当のガンマ関数 .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .BI "double tgamma(double " x ); .br .BI "float tgammaf(float " x ); .br .BI "long double tgammal(long double " x ); .sp .\"O Link with \fI\-lm\fP. \fI\-lm\fP でリンクする。 .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .ad l .BR tgamma (), .BR tgammaf (), .BR tgammal (): .RS 4 _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L; .br or .I cc\ -std=c99 .RE .ad .\"O .SH DESCRIPTION .SH 説明 .\"O The Gamma function is defined by .\"O .sp .\"O Gamma(x) = integral from 0 to infinity of t^(x\-1) e^\-t dt .\"O .sp .\"O It is defined for every real number except for nonpositive integers. ガンマ関数は以下のように定義される: .sp Gamma(x) = t^(x\-1) e^\-t dt の 0 から無限大までの積分 .sp この関数は正でない整数を除くすべての実数に対して定義されている。 .\"O For nonnegative integral \fIm\fP one has .\"O .sp .\"O Gamma(m+1) = m! .\"O .sp .\"O and, more generally, for all \fIx\fP: .\"O .sp .\"O Gamma(x+1) = x * Gamma(x) .\"O .sp .\"O Furthermore, the following is valid for all values of \fIx\fP .\"O outside the poles: .\"O .sp .\"O Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x) .\"O .PP 非負の整数 \fIm\fP に関して、以下が成立する: .sp Gamma(m+1) = m! .sp より一般的には、すべての \fIx\fP に関して以下が成立する: .sp Gamma(x+1) = x * Gamma(x) .sp さらに、極を除くすべての \fIx\fP で次式も成立する: .sp Gamma(x) * Gamma(1 \- x) = PI / sin(PI * x) .PP .\"O .SH RETURN VALUE .SH 返り値 .\"O On success, these functions return Gamma(x). 成功すると、これらの関数は Gamma(x) を返す。 .\"O If .\"O .I x .\"O is a NaN, a NaN is returned. .I x が NaN の場合、NaN が返される。 .\"O If .\"O .I x .\"O is positive infinity, positive infinity is returned. .I x が正の無限大の場合、正の無限大が返される。 .\"O If .\"O .I x .\"O is a negative integer, or is negative infinity, .\"O a domain error occurs, .\"O and a NaN is returned. .I x が負の整数か負の無限大の場合、領域エラー (domain error) が発生し、 NaN が返される。 .\"O If the result overflows, .\"O a range error occurs, .\"O and the functions return .\"O .BR HUGE_VAL , .\"O .BR HUGE_VALF , .\"O or .\"O .BR HUGE_VALL , .\"O respectively, with the correct mathematical sign. 結果がオーバーフローする場合、範囲エラー (range error) が発生し、 各関数はそれぞれ .BR HUGE_VAL , .BR HUGE_VALF , .BR HUGE_VALL , を返す。この際、数学的に正しい符号が付与される。 .\"O If the result underflows, .\"O a range error occurs, .\"O and the functions return 0, with the correct mathematical sign. 結果がアンダーフローする場合、範囲エラー (range error) が発生し、 関数は 0 をを返す。この際、数学的に正しい符号が付与される。 .\"O If .\"O .I x .\"O is -0 or +0, .\"O a pole error occurs, .\"O and the functions return .\"O .BR HUGE_VAL , .\"O .BR HUGE_VALF , .\"O or .\"O .BR HUGE_VALL , .\"O respectively, with the same sign as the 0. .I x が \-0 か +0 の場合、極エラー (pole error) が発生し、 各関数はそれぞれ .BR HUGE_VAL , .BR HUGE_VALF , .BR HUGE_VALL , を返す。 0 と同じ符号が付与される。 .\"O .SH ERRORS .SH エラー .\"O See .\"O .BR math_error (7) .\"O for information on how to determine whether an error has occurred .\"O when calling these functions. これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は .BR math_error (7) を参照のこと。 .PP .\"O The following errors can occur: 以下のエラーが発生する可能性がある。 .TP .\"O Domain error: \fIx\fP is a negative integer, or negative infinity 領域エラー: \fIx\fP が負の整数か負の無限大 .\" FIXME . errno is not set to EDOM for x == -inf .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809 .\"O .I errno .\"O is set to .\"O .BR EDOM . .\"O An invalid floating-point exception .\"O .RB ( FE_INVALID ) .\"O is raised (but see BUGS). .I errno に .B EDOM が設定される。 不正 (invalid) 浮動小数点例外 .RB ( FE_INVALID ) が上がる (「バグ」の節を参照)。 .TP .\"O Pole error: \fIx\fP is +0 or \-0 極エラー (pole error): \fIx\fP が +0 か \-0 .\"O .I errno .\"O is set to .\"O .BR ERANGE . .\"O A divide-by-zero floating-point exception .\"O .RB ( FE_DIVBYZERO ) .\"O is raised. .I errno に .B ERANGE が設定される。 0 による除算 (divide-by-zero) 浮動小数点例外 .RB ( FE_DIVBYZERO ) が上がる。 .TP .\"O Range error: result overflow 範囲エラー (range error): 結果のオーバーフロー .\"O .I errno .\"O is set to .\"O .BR ERANGE . .\"O An overflow floating-point exception .\"O .RB ( FE_OVERFLOW ) .\"O is raised. .I errno に .B ERANGE が設定される。 オーバーフロー浮動小数点例外 .RB ( FE_OVERFLOW ) が上がる。 .PP .\"O glibc also gives the following error which is not specified .\"O in C99 or POSIX.1-2001. glibc では、C99 や POSIX.1-2001 で規定されていない以下のエラーも 起こり得る。 .TP .\"O Range error: result underflow 範囲エラー (range error): 結果のアンダーフロー .\" e.g., tgamma(-172.5) on glibc 2.8/x86-32 .\" .I errno .\" is set to .\" .BR ERANGE . .\"O An underflow floating-point exception .\"O .RB ( FE_UNDERFLOW ) .\"O is raised. .\"O .IP .\"O .I errno .\"O is not set for this case. アンダーフロー浮動小数点例外 .RB ( FE_UNDERFLOW ) が上がる。 この場合は .I errno は設定されない。 .\" FIXME . Is it intentional that errno is not set: .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6810 .\" .\" glibc (as at 2.8) also supports and an inexact .\" exception for various cases. .\"O .SH VERSIONS .SH バージョン .\"O These functions first appeared in glibc in version 2.1. これらの関数は glibc バージョン 2.1 で初めて登場した。 .\"O .SH "CONFORMING TO" .SH 準拠 C99, POSIX.1-2001. .\"O .SH NOTES .SH 注意 .\"O This function had to be called "true gamma function" .\"O since there is already a function .\"O .BR gamma (3) .\"O that returns something else (see .\"O .BR gamma (3) .\"O for details). この関数を「本当の (true) ガンマ関数」と呼ばなければならなかった。 なぜなら、他の値を返す .BR gamma (3) という関数がすでに存在するからである (詳細については .BR gamma (3) を参照)。 .\"O .SH BUGS .SH バグ .\"O If .\"O .I x .\"O is negative infinity, .\"O .I errno .\"O is not set (it should be set to .\"O .BR EDOM ). .I x が負の無限大の場合、 .I errno は設定されない .RB ( EDOM が設定されるべきである)。 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6809 .\"O In glibc versions 2.3.3 and earlier, .\"O an argument of +0 or -0 incorrectly produced a domain error .\"O .RI ( errno .\"O set to .\"O .B EDOM .\"O and an .\"O .B FE_INVALID .\"O exception raised), rather than a pole error. glibc バージョン 2.3.3 以前では、 引き数に +0 や \-0 を渡すと、極エラーではなく、 領域エラーを間違って発生していた (領域エラーの場合、 .I errno に .B EDOM を設定され、 .B FE_INVALID 例外が発生する)。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR gamma (3), .BR lgamma (3)