w_lgamma_r.c 1002 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * ====================================================
  3. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  4. *
  5. * Developed at SunPro, a Sun Microsystems, Inc. business.
  6. * Permission to use, copy, modify, and distribute this
  7. * software is freely granted, provided that this notice
  8. * is preserved.
  9. * ====================================================
  10. */
  11. /*
  12. * wrapper double lgamma_r(double x, int *signgamp)
  13. */
  14. #include "math.h"
  15. #include "math_private.h"
  16. double lgamma_r(double x, int *signgamp) /* wrapper lgamma_r */
  17. {
  18. #ifdef _IEEE_LIBM
  19. return __ieee754_lgamma_r(x,signgamp);
  20. #else
  21. double y;
  22. y = __ieee754_lgamma_r(x,signgamp);
  23. if(_LIB_VERSION == _IEEE_) return y;
  24. if(!isfinite(y)&&isfinite(x)) {
  25. if(floor(x)==x&&x<=0.0)
  26. return __kernel_standard(x,x,15); /* lgamma pole */
  27. else
  28. return __kernel_standard(x,x,14); /* lgamma overflow */
  29. } else
  30. return y;
  31. #endif
  32. }