w_lgammal_r.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* w_lgammal_r.c -- long double version of w_lgamma_r.c.
  2. * Conversion to long double by Ulrich Drepper,
  3. * Cygnus Support, drepper@cygnus.com.
  4. */
  5. /*
  6. * ====================================================
  7. * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  8. *
  9. * Developed at SunPro, a Sun Microsystems, Inc. business.
  10. * Permission to use, copy, modify, and distribute this
  11. * software is freely granted, provided that this notice
  12. * is preserved.
  13. * ====================================================
  14. */
  15. /*
  16. * wrapper long double lgammal_r(long double x, int *signgamp)
  17. */
  18. #include <math.h>
  19. #include "math_private.h"
  20. #if !defined __NO_LONG_DOUBLE_MATH
  21. libm_hidden_proto(lgammal_r)
  22. long double
  23. lgammal_r(long double x, int *signgamp)
  24. {
  25. # if __UCLIBC_HAS_FENV__
  26. long double y = (long double) __ieee754_lgamma_r((double)x,signgamp);
  27. if(__builtin_expect(!isfinite(y), 0)
  28. && isfinite(x) && _LIB_VERSION != _IEEE_)
  29. return __kernel_standard(x, x,
  30. floorl(x)==x&&x<=0.0
  31. ? 215 /* lgamma pole */
  32. : 214); /* lgamma overflow */
  33. return y;
  34. # else
  35. return (long double) __ieee754_lgamma_r((double)x,signgamp);
  36. # endif /* __UCLIBC_HAS_FENV__ */
  37. }
  38. libm_hidden_def(lgammal_r)
  39. #endif /* __NO_LONG_DOUBLE_MATH */