1 /* ef_tgamma.c -- float version of e_tgamma.c.
2  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3  */
4 
5 /*
6  * ====================================================
7  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8  *
9  * Developed at SunPro, a Sun Microsystems, Inc. business.
10  * Permission to use, copy, modify, and distribute this
11  * software is freely granted, provided that this notice
12  * is preserved.
13  * ====================================================
14  *
15  */
16 
17 /* tgammaf(x)
18  * Float version the Gamma function. Returns gamma(x)
19  *
20  * Method: See lgammaf
21  */
22 
23 #include "fdlibm.h"
24 
25 float
tgammaf(float x)26 tgammaf(float x)
27 {
28     int signgam_local;
29     int divzero = 0;
30 
31     if (isless(x, 0.0f) && clang_barrier_float(rintf(x)) == x)
32         return __math_invalidf(x);
33 
34     float y = expf(__math_lgammaf_r(x, &signgam_local, &divzero));
35     if (signgam_local < 0)
36         y = -y;
37     if (isinff(y) && finitef(x) && !divzero)
38         return __math_oflowf(signgam_local < 0);
39     return y;
40 }
41 
42 _MATH_ALIAS_f_f(tgamma)
43