w_lgamma_r.c 995 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* @(#)wr_lgamma.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. /*
  13. * wrapper double lgamma_r(double x, int *signgamp)
  14. */
  15. #include <math.h>
  16. #include "math_private.h"
  17. libm_hidden_proto(lgamma_r)
  18. double
  19. lgamma_r(double x, int *signgamp)
  20. {
  21. #if defined(__UCLIBC_HAS_FENV__)
  22. double y = __ieee754_lgamma_r(x,signgamp);
  23. if(__builtin_expect(!isfinite(y), 0)
  24. && isfinite(x) && _LIB_VERSION != _IEEE_)
  25. return __kernel_standard(x, x,
  26. floor(x)==x&&x<=0.0
  27. ? 15 /* lgamma pole */
  28. : 14); /* lgamma overflow */
  29. return y;
  30. #else
  31. return __ieee754_lgamma_r(x,signgamp);
  32. #endif /* __UCLIBC_HAS_FENV__ */
  33. }
  34. libm_hidden_def(lgamma_r)