blob: 8abe6a018fe2a7c8f7ac585ca34b6428c54380c2 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* w_lgammal.c -- long double version of w_lgamma.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 lgammal(long double x)
18 * Return the logarithm of the Gamma function of x.
19 *
20 * Method: call __ieee754_lgammal_r
21 */
22
23#include <math.h>
24#include <math_private.h>
25
26long double
27__lgammal(long double x)
28{
29 int local_signgam = 0;
30 long double y = __ieee754_lgammal_r(x,
31 _LIB_VERSION != _ISOC_
32 /* ISO C99 does not define the
33 global variable. */
34 ? &signgam
35 : &local_signgam);
36 if(__builtin_expect(!isfinite(y), 0)
37 && isfinite(x) && _LIB_VERSION != _IEEE_)
38 return __kernel_standard_l(x, x,
39 __floorl(x)==x&&x<=0.0L
40 ? 215 /* lgamma pole */
41 : 214); /* lgamma overflow */
42
43 return y;
44}
45weak_alias (__lgammal, lgammal)
46strong_alias (__lgammal, __gammal)
47weak_alias (__gammal, gammal)