1 /* wf_gamma.c -- float version of w_gamma.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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
13 * ====================================================
29 return __ieee754_gammaf_r(x
,&(_REENT_SIGNGAM(_REENT
)));
33 y
= __ieee754_gammaf_r(x
,&(_REENT_SIGNGAM(_REENT
)));
34 if(_LIB_VERSION
== _IEEE_
) return y
;
35 if(!finitef(y
)&&finitef(x
)) {
40 SET_HIGH_WORD(inf
,0x7ff00000); /* set inf to infinite */
42 if(floorf(x
)==x
&&x
<=(float)0.0) {
43 /* gammaf(-integer) or gammaf(0) */
47 exc
.arg1
= exc
.arg2
= (double)x
;
48 if (_LIB_VERSION
== _SVID_
)
51 exc
.retval
= HUGE_VAL
;
52 if (_LIB_VERSION
== _POSIX_
)
54 else if (!matherr(&exc
)) {
58 /* gammaf(finite) overflow */
62 exc
.arg1
= exc
.arg2
= (double)x
;
63 if (_LIB_VERSION
== _SVID_
)
66 exc
.retval
= HUGE_VAL
;
67 if (_LIB_VERSION
== _POSIX_
)
69 else if (!matherr(&exc
)) {
75 return (float)exc
.retval
;
81 #ifdef _DOUBLE_IS_32BITS
84 double gamma(double x
)
90 return (double) gammaf((float) x
);
93 #endif /* defined(_DOUBLE_IS_32BITS) */