NAG Library Function Document
nag_scaled_log_gamma (s14ahc) returns the value of , the scaled logarithm of the gamma function .
||nag_scaled_log_gamma (double x,
nag_scaled_log_gamma (s14ahc) calculates an approximate value for
. This is a variant of the
function (see also nag_log_gamma (s14abc)
), which avoids rounding problems for very large arguments by computing
with the Stirling approximation factored out.
For , ;
and for , , where is a suitable Remez approximation.
, the value
is undefined; nag_scaled_log_gamma (s14ahc) returns zero and exits with NE_REAL_ARG_LE
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
x – doubleInput
On entry: the argument of the function.
fail – NagError *Input/Output
The NAG error argument (see Section 3.6
in the Essential Introduction).
6 Error Indicators and Warnings
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG
On entry, .
nag_scaled_log_gamma (s14ahc) has been designed to produce full relative accuracy for all input arguments. Empirical results obtained by comparing with multiprecision software confirm this.
This example reads values of the argument from a file, evaluates the function at each value of and prints the results.
9.1 Program Text
Program Text (s14ahce.c)
9.2 Program Data
Program Data (s14ahce.d)
9.3 Program Results
Program Results (s14ahce.r)