1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #include "slatec-internal.hpp"
- static integer const c__2 = 2;
- static integer const c__4 = 4;
- static integer const c__3 = 3;
- static integer const c__1 = 1;
- static double const sq2pil = .91893853320467274178032973640562;
- static double const sqpi2l = .225791352644727432363097614947441;
- static double const pi = 3.1415926535897932384626433832795;
- static double const temp = 1. / log(d1mach_(2));
- static double const xmax = temp * d1mach_(2);
- static double const dxrel = sqrt(d1mach_(4));
- double dlngam_(double const *x)
- {
-
-
- double d__1, d__2;
-
- double y;
- double sinpiy;
- y = abs(*x);
- if (y > 10.) {
- goto L20;
- }
- return log(abs(dgamma_(x)));
- L20:
- if (y > xmax) {
- xermsg_("SLATEC", "DLNGAM", "ABS(X) SO BIG DLNGAM OVERFLOWS", &c__2, &
- c__2, (ftnlen)6, (ftnlen)6, (ftnlen)30);
- }
- if (*x > 0.) {
- return sq2pil + (*x - .5) * log(*x) - *x + d9lgmc_(&y);
- }
- sinpiy = (d__1 = sin(pi * y), abs(d__1));
- if (sinpiy == 0.) {
- xermsg_("SLATEC", "DLNGAM", "X IS A NEGATIVE INTEGER", &c__3, &c__2, (
- ftnlen)6, (ftnlen)6, (ftnlen)23);
- }
- d__2 = *x - .5;
- if ((d__1 = (*x - f2c::d_int(&d__2)) / *x, abs(d__1)) < dxrel) {
- xermsg_("SLATEC", "DLNGAM", "ANSWER LT HALF PRECISION BECAUSE X TOO \
- NEAR NEGATIVE INTEGER", &c__1, &c__1, (ftnlen)6, (ftnlen)6, (ftnlen)60);
- }
- return sqpi2l + (*x - .5) * log(y) - *x - log(sinpiy) - d9lgmc_(&y);
- }
|