xref: /netbsd/lib/libm/src/w_lgammaf_r.c (revision aa30599e)
18346e333Sjtc /* w_lgammaf_r.c -- float version of w_lgamma_r.c.
28346e333Sjtc  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
38346e333Sjtc  */
48346e333Sjtc 
58346e333Sjtc /*
68346e333Sjtc  * ====================================================
78346e333Sjtc  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
88346e333Sjtc  *
98346e333Sjtc  * Developed at SunPro, a Sun Microsystems, Inc. business.
108346e333Sjtc  * Permission to use, copy, modify, and distribute this
118346e333Sjtc  * software is freely granted, provided that this notice
128346e333Sjtc  * is preserved.
138346e333Sjtc  * ====================================================
148346e333Sjtc  */
158346e333Sjtc 
16118c71a6Slukem #include <sys/cdefs.h>
17d1f06e0bSjtc #if defined(LIBM_SCCS) && !defined(lint)
18*aa30599eSwiz __RCSID("$NetBSD: w_lgammaf_r.c,v 1.7 2002/05/26 22:02:02 wiz Exp $");
198346e333Sjtc #endif
208346e333Sjtc 
218346e333Sjtc /*
228346e333Sjtc  * wrapper float lgammaf_r(float x, int *signgamp)
238346e333Sjtc  */
248346e333Sjtc 
258346e333Sjtc #include "math.h"
268346e333Sjtc #include "math_private.h"
278346e333Sjtc 
28*aa30599eSwiz float
lgammaf_r(float x,int * signgamp)29*aa30599eSwiz lgammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
308346e333Sjtc {
318346e333Sjtc #ifdef _IEEE_LIBM
328346e333Sjtc 	return __ieee754_lgammaf_r(x,signgamp);
338346e333Sjtc #else
348346e333Sjtc         float y;
358346e333Sjtc         y = __ieee754_lgammaf_r(x,signgamp);
368346e333Sjtc         if(_LIB_VERSION == _IEEE_) return y;
378346e333Sjtc         if(!finitef(y)&&finitef(x)) {
388346e333Sjtc             if(floorf(x)==x&&x<=(float)0.0)
398346e333Sjtc 	        /* lgamma pole */
408346e333Sjtc                 return (float)__kernel_standard((double)x,(double)x,115);
418346e333Sjtc             else
428346e333Sjtc 	        /* lgamma overflow */
438346e333Sjtc 	        return (float)__kernel_standard((double)x,(double)x,114);
448346e333Sjtc         } else
458346e333Sjtc             return y;
468346e333Sjtc #endif
478346e333Sjtc }
48