w_gamma_r.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* @(#)wr_gamma.c 5.1 93/09/24 */
  2. /*
  3. * ====================================================
  4. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  5. *
  6. * Developed at SunPro, a Sun Microsystems, Inc. business.
  7. * Permission to use, copy, modify, and distribute this
  8. * software is freely granted, provided that this notice
  9. * is preserved.
  10. * ====================================================
  11. */
  12. #if defined(LIBM_SCCS) && !defined(lint)
  13. static char rcsid[] = "$NetBSD: w_gamma_r.c,v 1.7 1995/11/20 22:06:45 jtc Exp $";
  14. #endif
  15. /*
  16. * wrapper double gamma_r(double x, int *signgamp)
  17. */
  18. #include "math.h"
  19. #include "math_private.h"
  20. double gamma_r(double x, int *signgamp);
  21. libm_hidden_proto(gamma_r)
  22. #ifdef __STDC__
  23. double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
  24. #else
  25. double gamma_r(x,signgamp) /* wrapper lgamma_r */
  26. double x; int *signgamp;
  27. #endif
  28. {
  29. #ifdef _IEEE_LIBM
  30. return __ieee754_lgamma_r(x,signgamp);
  31. #else
  32. double y;
  33. y = __ieee754_lgamma_r(x,signgamp);
  34. if(_LIB_VERSION == _IEEE_) return y;
  35. if(!finite(y)&&finite(x)) {
  36. if(floor(x)==x&&x<=0.0)
  37. return __kernel_standard(x,x,41); /* gamma pole */
  38. else
  39. return __kernel_standard(x,x,40); /* gamma overflow */
  40. } else
  41. return y;
  42. #endif
  43. }
  44. libm_hidden_def(gamma_r)