1 /* wf_lgamma.c -- float version of w_lgamma.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 * ====================================================
22 float lgammaf(float x
)
29 return __ieee754_lgammaf_r(x
,&(_REENT_SIGNGAM(_REENT
)));
33 y
= __ieee754_lgammaf_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 */
44 exc
.arg1
= exc
.arg2
= (double)x
;
45 if (_LIB_VERSION
== _SVID_
)
48 exc
.retval
= HUGE_VAL
;
49 if(floorf(x
)==x
&&x
<=(float)0.0) {
50 /* lgammaf(-integer) */
52 if (_LIB_VERSION
== _POSIX_
)
54 else if (!matherr(&exc
)) {
59 /* lgammaf(finite) overflow */
61 if (_LIB_VERSION
== _POSIX_
)
63 else if (!matherr(&exc
)) {
69 return (float)exc
.retval
;
75 #ifdef _DOUBLE_IS_32BITS
78 double lgamma(double x
)
84 return (double) lgammaf((float) x
);
87 #endif /* defined(_DOUBLE_IS_32BITS) */