if (fabs(creal(x)) > 18.0)
{ if( creal(x) < 0.0 )
{
q = creal(x);
p = floor(q); if((p == q) && (cimag(x) == 0.0))
{
mtherr( "cgamma", OVERFLOW ); return( MAXNUM + I * MAXNUM);
} /* c = csin( PI * x ); */ /* Compute sin(pi x) */
k = q - 2.0 * floor (0.5 * q);
q = PI * (q - p);
p = PI * cimag(x);
c = sin(q) * cosh(p) + cos(q) * sinh(p) * I; if (k & 1)
c = -c; /* Reflection formula. */
c = PI/(c * cgamma(1.0 - x) );
} else
{
c = cstirf(x);
} return( c );
}
c = 1.0;
p = 0.0;
u = x; while( creal(u) < 18.0 )
{ if ((fabs(creal(u)) < 1.0e-9) && (fabs(cimag(u)) < 1.0e-9)) goto small;
c *= u;
p += 1.0;
u = x + p;
}
u = cstirf(u); return( u / c );
double complex clgam(x) double complex x;
{ double p, q, a; double complex c, w, u, v; int i, cj;
cj = 0; if (cimag(x) < 0)
{
cj = 1;
x = conj(x);
}
/* Reflection formula -z gamma(-z) gamma(z) = pi / sin(pi z) */ if((creal(x) < -14.0) || (cimag(x) < -14.0))
{
q = creal(x);
p = floor(q); if( p == q ) goto loverf; if (fabs(cimag(x)) > 36.7)
{ /* sin z grows exponentially with Im(z). Find ln sin(pi z) from|sinz|=sqrt(sin^2x+sinh^2y),
arg sin z = arctan(tanh y / tan x). */
c = PI * cimag(x) - 0.6931471805599453094
+ I * PI * (0.5 - q);
c = LOGPI - c - clgam(1.0 - x);
} else
{ /* Reduce sine arg mod pi. */
u = csin( PI * (x - p) ); if( u == 0.0 ) goto loverf;
w = clgam(1.0 - x);
c = LOGPI - clog( u ) - w; /* Adjust for reduced sine arg. */
cimag(c) += PI * p;
} goto ldone;
}
w = 0.0; if(creal(x) < 14.0 )
{ /* To satisfy Im {clgam(z)} = arg cgamma(z), accumulate
arg u during the recurrence. */
a = 0.0;
w = 1.0;
p = 0.0;
u = x; while( creal(u) < 14.0 )
{ if( u == 0.0 ) goto loverf;
w *= u;
a += carg(u);
p += 1.0;
u = x + p;
}
x = u;
w = -log(cabs(w)) - I * a;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.