Back to index

glibc  2.9
w_lgammaf.c
Go to the documentation of this file.
00001 /* w_lgammaf.c -- float version of w_lgamma.c.
00002  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
00003  */
00004 
00005 /*
00006  * ====================================================
00007  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
00008  *
00009  * Developed at SunPro, a Sun Microsystems, Inc. business.
00010  * Permission to use, copy, modify, and distribute this
00011  * software is freely granted, provided that this notice
00012  * is preserved.
00013  * ====================================================
00014  */
00015 
00016 #if defined(LIBM_SCCS) && !defined(lint)
00017 static char rcsid[] = "$NetBSD: w_lgammaf.c,v 1.3 1995/05/10 20:49:30 jtc Exp $";
00018 #endif
00019 
00020 #include <math.h>
00021 #include "math_private.h"
00022 
00023 #ifdef __STDC__
00024        float __lgammaf(float x)
00025 #else
00026        float __lgammaf(x)
00027        float x;
00028 #endif
00029 {
00030 #ifdef _IEEE_LIBM
00031        return __ieee754_lgammaf_r(x,&signgam);
00032 #else
00033         float y;
00034        int local_signgam = 0;
00035         y = __ieee754_lgammaf_r(x,&local_signgam);
00036        if (_LIB_VERSION != _ISOC_)
00037          /* ISO C99 does not define the global variable.  */
00038          signgam = local_signgam;
00039         if(_LIB_VERSION == _IEEE_) return y;
00040         if(!__finitef(y)&&__finitef(x)) {
00041             if(__floorf(x)==x&&x<=(float)0.0)
00042                /* lgamma pole */
00043                 return (float)__kernel_standard((double)x,(double)x,115);
00044             else
00045                /* lgamma overflow */
00046                 return (float)__kernel_standard((double)x,(double)x,114);
00047         } else
00048             return y;
00049 #endif
00050 }
00051 weak_alias (__lgammaf, lgammaf)
00052 strong_alias (__lgammaf, __gammaf)
00053 weak_alias (__gammaf, gammaf)