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