| 1 | /* w_gammal.c -- long double version of w_gamma.c. | 
|---|
| 2 | * Conversion to long double by Ulrich Drepper, | 
|---|
| 3 | * Cygnus Support, drepper@cygnus.com. | 
|---|
| 4 | */ | 
|---|
| 5 |  | 
|---|
| 6 | /* | 
|---|
| 7 | * ==================================================== | 
|---|
| 8 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | 
|---|
| 9 | * | 
|---|
| 10 | * Developed at SunPro, a Sun Microsystems, Inc. business. | 
|---|
| 11 | * Permission to use, copy, modify, and distribute this | 
|---|
| 12 | * software is freely granted, provided that this notice | 
|---|
| 13 | * is preserved. | 
|---|
| 14 | * ==================================================== | 
|---|
| 15 | */ | 
|---|
| 16 |  | 
|---|
| 17 | /* long double gammal(double x) | 
|---|
| 18 | * Return the Gamma function of x. | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | #include <errno.h> | 
|---|
| 22 | #include <math.h> | 
|---|
| 23 | #include <math_private.h> | 
|---|
| 24 | #include <math-svid-compat.h> | 
|---|
| 25 | #include <libm-alias-ldouble.h> | 
|---|
| 26 |  | 
|---|
| 27 | #if LIBM_SVID_COMPAT | 
|---|
| 28 | long double | 
|---|
| 29 | __tgammal(long double x) | 
|---|
| 30 | { | 
|---|
| 31 | int local_signgam; | 
|---|
| 32 | long double y = __ieee754_gammal_r(x,&local_signgam); | 
|---|
| 33 |  | 
|---|
| 34 | if(__glibc_unlikely (!isfinite (y) || y == 0) | 
|---|
| 35 | && (isfinite (x) || (isinf (x) && x < 0.0)) | 
|---|
| 36 | && _LIB_VERSION != _IEEE_) { | 
|---|
| 37 | if(x==0.0) | 
|---|
| 38 | return __kernel_standard_l(x,x,250); /* tgamma pole */ | 
|---|
| 39 | else if(floorl(x)==x&&x<0.0L) | 
|---|
| 40 | return __kernel_standard_l(x,x,241); /* tgamma domain */ | 
|---|
| 41 | else if (y == 0) | 
|---|
| 42 | __set_errno (ERANGE); /* tgamma underflow */ | 
|---|
| 43 | else | 
|---|
| 44 | return __kernel_standard_l(x,x,240); /* tgamma overflow */ | 
|---|
| 45 | } | 
|---|
| 46 | return local_signgam < 0 ? - y : y; | 
|---|
| 47 | } | 
|---|
| 48 | libm_alias_ldouble (__tgamma, tgamma) | 
|---|
| 49 | #endif | 
|---|
| 50 |  | 
|---|