mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-20 17:51:16 +00:00
cc60175e8c
1998-07-23 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/glob.c: Fix two problems with GLOB_DOOFFS. Reported by bwelling@anomaly.munge.com [PR libc/720]. * sysdeps/libm-ieee754/k_standard.c: Return NAN for libm not in SVID more for gamma(x) with x interger <= 0. Reported by Stephen L Moshier <moshier@mediaone.net>. * math/libm-test.c (gamma_test): Add test for gamma(-1) and gamma(0). Correct test for SVID version of gamma. * sysdeps/libm-ieee754/w_gamma.c: Use correct matherr call in SVID emulation mode. * sysdeps/libm-ieee754/w_gammaf.c: Likewise. * sysdeps/libm-ieee754/w_gammal.c: Likewise. * string/string.h: Don't use string function optimization for C++ as long as we use macros.
72 lines
1.7 KiB
C
72 lines
1.7 KiB
C
/* w_gammal.c -- long double version of w_gamma.c.
|
|
* Conversion to long double by Ulrich Drepper,
|
|
* Cygnus Support, drepper@cygnus.com.
|
|
*/
|
|
|
|
/*
|
|
* ====================================================
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
*
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software is freely granted, provided that this notice
|
|
* is preserved.
|
|
* ====================================================
|
|
*/
|
|
|
|
#if defined(LIBM_SCCS) && !defined(lint)
|
|
static char rcsid[] = "$NetBSD: $";
|
|
#endif
|
|
|
|
/* long double gammal(double x)
|
|
* Return the Gamma function of x.
|
|
*/
|
|
|
|
#include "math.h"
|
|
#include "math_private.h"
|
|
|
|
#ifdef __STDC__
|
|
long double __gammal(long double x)
|
|
#else
|
|
long double __gammal(x)
|
|
long double x;
|
|
#endif
|
|
{
|
|
long double y;
|
|
#ifndef _IEEE_LIBM
|
|
if (_LIB_VERSION == _SVID_)
|
|
{
|
|
y = __ieee754_lgammal_r(x,&signgam);
|
|
|
|
if(!__finitel(y)&&__finitel(x)) {
|
|
if(__floorl(x)==x&&x<=(long double)0.0)
|
|
/* lgamma pole */
|
|
return (long double)__kernel_standard((double)x,(double)x,15);
|
|
else
|
|
/* lgamma overflow */
|
|
return (long double)__kernel_standard((double)x,(double)x,14);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
#endif
|
|
int local_signgam;
|
|
y = __ieee754_gammal_r(x,&local_signgam);
|
|
if (local_signgam < 0) y = -y;
|
|
#ifdef _IEEE_LIBM
|
|
return y;
|
|
#else
|
|
if(_LIB_VERSION == _IEEE_) return y;
|
|
|
|
if(!__finitel(y)&&__finitel(x)) {
|
|
if(__floorl(x)==x&&x<=0.0)
|
|
return __kernel_standard(x,x,241); /* gamma pole */
|
|
else
|
|
return __kernel_standard(x,x,240); /* gamma overflow */
|
|
}
|
|
}
|
|
return y;
|
|
#endif
|
|
}
|
|
weak_alias (__gammal, gammal)
|