N. M. Temme, "Special Functions" (Wiley 1996) gives the following expression that expresses the upper incomplete gamma function in terms of the ordinary gamma function, for integer orders:
$$ \Gamma(n,z) = \Gamma(n) e^{-z} \sum_{m=0}^{n-1} \frac{z^m}{m!} \\ n=1,2,... $$
My experiments indicate that this is a convenient way to compute the upper incomplete gamma function for small integer orders as the computation appears to be numerically stable. I tried orders up to n=50 and a wide range of real z.
Is there a similar expression that allows the straightforward computation of the upper incomplete gamma function in terms of the ordinary gamma function, for half-integer orders, that is, $ \Gamma(n+\frac{1}{2},z) $? I am aware that $ \Gamma(\frac{1}{2},z) = \sqrt{\pi} erfc(\sqrt{z}) $.
tgamma()that computes $ \Gamma(x) $ accurately, if a good math library is provided. The remaining computation does not involve subtractive cancellation and excessive round-off error, so a straight rendering of the above into C++ code (for n <= 50) seems to be accurate to about 15 decimal digits if the entire computation is performed in double precision. I am not a numerical analyst, just a computer science guy, so I determined the stability empirically (which is why I stated that it "appears" to be stable). I took care to avoid intermediate underflow inexp(-z). – njuffa Mar 24 '14 at 03:15