w_lgamma_main.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /* @(#)w_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. /* double lgamma(double x)
  13. * Return the logarithm of the Gamma function of x.
  14. *
  15. * Method: call __ieee754_lgamma_r
  16. */
  17. #include <math.h>
  18. #include <math_private.h>
  19. #include <math-svid-compat.h>
  20. #include <libm-alias-double.h>
  21. #include <lgamma-compat.h>
  22. #if BUILD_LGAMMA
  23. double
  24. LGFUNC (__lgamma) (double x)
  25. {
  26. double y = CALL_LGAMMA (double, __ieee754_lgamma_r, x);
  27. if(__builtin_expect(!isfinite(y), 0)
  28. && isfinite(x) && _LIB_VERSION != _IEEE_)
  29. return __kernel_standard(x, x,
  30. floor(x)==x&&x<=0.0
  31. ? 15 /* lgamma pole */
  32. : 14); /* lgamma overflow */
  33. return y;
  34. }
  35. # if USE_AS_COMPAT
  36. compat_symbol (libm, __lgamma_compat, lgamma, LGAMMA_OLD_VER);
  37. # ifdef NO_LONG_DOUBLE
  38. strong_alias (__lgamma_compat, __lgammal_compat)
  39. compat_symbol (libm, __lgammal_compat, lgammal, LGAMMA_OLD_VER);
  40. # endif
  41. # else
  42. versioned_symbol (libm, __lgamma, lgamma, LGAMMA_NEW_VER);
  43. # ifdef NO_LONG_DOUBLE
  44. strong_alias (__lgamma, __lgammal)
  45. versioned_symbol (libm, __lgammal, lgammal, LGAMMA_NEW_VER);
  46. # endif
  47. libm_alias_double_other (__lgamma, lgamma)
  48. # endif
  49. # if GAMMA_ALIAS
  50. strong_alias (LGFUNC (__lgamma), __gamma)
  51. weak_alias (__gamma, gamma)
  52. # ifdef NO_LONG_DOUBLE
  53. strong_alias (__gamma, __gammal)
  54. weak_alias (__gamma, gammal)
  55. # endif
  56. # endif
  57. #endif