1 
2 /* @(#)e_tgamma.c 5.1 93/09/24 */
3 /*
4  * ====================================================
5  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6  *
7  * Developed at SunPro, a Sun Microsystems, Inc. business.
8  * Permission to use, copy, modify, and distribute this
9  * software is freely granted, provided that this notice
10  * is preserved.
11  * ====================================================
12  *
13  */
14 
15 /* tgamma(x)
16  * Gamma function. Returns gamma(x)
17  *
18  * Method: See lgamma_r
19  */
20 
21 #include "fdlibm.h"
22 
23 #ifdef _NEED_FLOAT64
24 
25 __float64
tgamma64(__float64 x)26 tgamma64(__float64 x)
27 {
28     int signgam_local;
29     int divzero = 0;
30 
31     if (isless(x, 0.0) && clang_barrier_double(rint(x)) == x)
32         return __math_invalid(x);
33 
34     __float64 y = exp64(__math_lgamma_r(x, &signgam_local, &divzero));
35     if (signgam_local < 0)
36         y = -y;
37     if (isinf(y) && finite(x) && !divzero)
38         return __math_oflow(signgam_local < 0);
39     return y;
40 }
41 
42 _MATH_ALIAS_d_d(tgamma)
43 
44 #endif
45