Back to index

glibc  2.9
w_tgammaf.c
Go to the documentation of this file.
00001 /* w_gammaf.c -- float version of w_gamma.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_gammaf.c,v 1.4 1995/11/20 22:06:48 jtc Exp $";
00018 #endif
00019 
00020 #include <math.h>
00021 #include "math_private.h"
00022 
00023 #ifdef __STDC__
00024        float __tgammaf(float x)
00025 #else
00026        float __tgammaf(x)
00027        float x;
00028 #endif
00029 {
00030         float y;
00031        int local_signgam;
00032        y = __ieee754_gammaf_r(x,&local_signgam);
00033        if (local_signgam < 0) y = -y;
00034 #ifdef _IEEE_LIBM
00035        return y;
00036 #else
00037        if(_LIB_VERSION == _IEEE_) return y;
00038 
00039        if(!__finitef(y)&&__finitef(x)) {
00040          if (x == (float)0.0)
00041            /* tgammaf pole */
00042            return (float)__kernel_standard((double)x,(double)x,150);
00043          else if(__floorf(x)==x&&x<(float)0.0)
00044            /* tgammaf domain */
00045            return (float)__kernel_standard((double)x,(double)x,141);
00046          else
00047            /* tgammaf overflow */
00048            return (float)__kernel_standard((double)x,(double)x,140);
00049        }
00050        return y;
00051 #endif
00052 }
00053 weak_alias (__tgammaf, tgammaf)