(root)/
glibc-2.38/
math/
w_tgammal_compat.c
       1  /* w_gammal.c -- long double version of w_gamma.c.
       2   */
       3  
       4  /*
       5   * ====================================================
       6   * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
       7   *
       8   * Developed at SunPro, a Sun Microsystems, Inc. business.
       9   * Permission to use, copy, modify, and distribute this
      10   * software is freely granted, provided that this notice
      11   * is preserved.
      12   * ====================================================
      13   */
      14  
      15  /* long double gammal(double x)
      16   * Return the Gamma function of x.
      17   */
      18  
      19  #include <errno.h>
      20  #include <math.h>
      21  #include <math_private.h>
      22  #include <math-svid-compat.h>
      23  #include <libm-alias-ldouble.h>
      24  
      25  #if LIBM_SVID_COMPAT
      26  long double
      27  __tgammal(long double x)
      28  {
      29  	int local_signgam;
      30  	long double y = __ieee754_gammal_r(x,&local_signgam);
      31  
      32  	if(__glibc_unlikely (!isfinite (y) || y == 0)
      33  	   && (isfinite (x) || (isinf (x) && x < 0.0))
      34  	   && _LIB_VERSION != _IEEE_) {
      35  	  if(x==0.0)
      36  	    return __kernel_standard_l(x,x,250); /* tgamma pole */
      37  	  else if(floorl(x)==x&&x<0.0L)
      38  	    return __kernel_standard_l(x,x,241); /* tgamma domain */
      39  	  else if (y == 0)
      40  	    __set_errno (ERANGE); /* tgamma underflow */
      41  	  else
      42  	    return __kernel_standard_l(x,x,240); /* tgamma overflow */
      43  	}
      44  	return local_signgam < 0 ? - y : y;
      45  }
      46  libm_alias_ldouble (__tgamma, tgamma)
      47  #endif