Returns the logarithm of the absolute value of the gamma function and the sign of gamma.
X — Argument for which the logarithm of the absolute value of the gamma function is desired. (Input)
ALGM — Result of the calculation. (Output)
S — Sign of
gamma(X).
(Output)
If gamma(X) is greater than or
equal to zero, S
= 1.0. If gamma(X) is less than zero,
S = −1.0.
Generic: CALL ALGAMS (X, ALGM, S)
Specific: The specific interface names are S_ALGAMS and D_ALGAMS.
Single: CALL ALGAMS (X, ALGM, S)
Double: The double precision function name is DLGAMS.
The function ALGAMS computes ln |Γ(x)| and the sign of Γ(x). See GAMMA for the definition of Γ(x).
The result overflows if |x| is too large. The accuracy is worse than half precision if x is too close to a negative integer.
Informational error
Type Code
3 2 Result of ALGAMS is accurate to less than one-half precision because X is too near a negative integer.
In this example, ln |Γ(1.85)| and the sign of Γ(1.85) are computed and printed.
USE ALGAMS_INT
USE UMACH_INT
IMPLICIT NONE
! Declare variables
INTEGER NOUT
REAL VALUE, S, X
! Compute
X = 1.85
CALL ALGAMS(X, VALUE, S)
! Print the results
CALL UMACH (2, NOUT)
WRITE (NOUT,99998) X, VALUE
99998 FORMAT (' Log Abs(Gamma(', F6.3, ')) = ', F6.3)
WRITE (NOUT,99999) X, S
99999 FORMAT (' Sign(Gamma(', F6.3, ')) = ', F6.2)
END
Log Abs(Gamma( 1.850)) = -0.056
Sign(Gamma( 1.850)) = 1.00
PHONE: 713.784.3131 FAX:713.781.9260 |