Cosmetic changes only:

- style
- remove unused variables
- de-support VAX

Inspired by:	bin/42388
This commit is contained in:
David Schultz 2004-12-16 20:40:37 +00:00
parent 63173f5f56
commit 17519e9b79
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138924
3 changed files with 15 additions and 45 deletions

View File

@ -137,12 +137,11 @@ double x;
double __exp__D(x, c)
double x, c;
{
double z,hi,lo, t;
double z,hi,lo;
int k;
#if !defined(vax)&&!defined(tahoe)
if (x!=x) return(x); /* x is NaN */
#endif /* !defined(vax)&&!defined(tahoe) */
if (x != x) /* x is NaN */
return(x);
if ( x <= lnhuge ) {
if ( x >= lntiny ) {

View File

@ -77,15 +77,8 @@ __FBSDID("$FreeBSD$");
* +Inf return +Inf
*/
#if defined(vax) || defined(tahoe)
#define _IEEE 0
#define TRUNC(x) x = (double) (float) (x)
#else
#define _IEEE 1
#define endian (((*(int *) &one)) ? 1 : 0)
#define TRUNC(x) *(((int *) &x) + endian) &= 0xf8000000
#define infnan(x) 0.0
#endif
#define N 128
@ -381,26 +374,19 @@ log(x) double x;
/* Catch special cases */
if (x <= 0)
if (_IEEE && x == zero) /* log(0) = -Inf */
if (x == zero) /* log(0) = -Inf */
return (-one/zero);
else if (_IEEE) /* log(neg) = NaN */
else /* log(neg) = NaN */
return (zero/zero);
else if (x == zero) /* NOT REACHED IF _IEEE */
return (infnan(-ERANGE));
else
return (infnan(EDOM));
else if (!finite(x))
if (_IEEE) /* x = NaN, Inf */
return (x+x);
else
return (infnan(ERANGE));
return (x+x); /* x = NaN, Inf */
/* Argument reduction: 1 <= g < 2; x/2^m = g; */
/* y = F*(1 + f/F) for |f| <= 2^-8 */
m = logb(x);
g = ldexp(x, -m);
if (_IEEE && m == -1022) {
if (m == -1022) {
j = logb(g), m += j;
g = ldexp(g, -j);
}
@ -461,7 +447,7 @@ __log__D(x) double x;
m = logb(x);
g = ldexp(x, -m);
if (_IEEE && m == -1022) {
if (m == -1022) {
j = logb(g), m += j;
g = ldexp(g, -j);
}

View File

@ -124,18 +124,12 @@ static struct Double ratfun_gam(double, double);
static const double zero = 0., one = 1.0, tiny = 1e-300;
static int endian;
/*
* TRUNC sets trailing bits in a floating-point number to zero.
* is a temporary variable.
*/
#if defined(vax) || defined(tahoe)
#define _IEEE 0
#define TRUNC(x) x = (double) (float) (x)
#else
#define _IEEE 1
#define TRUNC(x) *(((int *) &x) + endian) &= 0xf8000000
#define infnan(x) 0.0
#endif
double
tgamma(x)
@ -155,16 +149,12 @@ tgamma(x)
return (smaller_gam(x));
else if (x > -1.e-17) {
if (x == 0.0)
if (!_IEEE) return (infnan(ERANGE));
else return (one/x);
return (one/x);
one+1e-20; /* Raise inexact flag. */
return (one/x);
} else if (!finite(x)) {
if (_IEEE) /* x = NaN, -Inf */
return (x*x);
else
return (infnan(EDOM));
} else
} else if (!finite(x))
return (x*x); /* x = NaN, -Inf */
else
return (neg_gam(x));
}
/*
@ -175,7 +165,6 @@ large_gam(x)
double x;
{
double z, p;
int i;
struct Double t, u, v;
z = one/(x*x);
@ -204,7 +193,7 @@ static double
small_gam(x)
double x;
{
double y, ym1, t, x1;
double y, ym1, t;
struct Double yy, r;
y = x - one;
ym1 = y - one;
@ -267,7 +256,6 @@ static struct Double
ratfun_gam(z, c)
double z, c;
{
int i;
double p, q;
struct Double r, t;
@ -301,10 +289,7 @@ neg_gam(x)
y = floor(x + .5);
if (y == x) /* Negative integer. */
if(!_IEEE)
return (infnan(ERANGE));
else
return (one/zero);
return (one/zero);
z = fabs(x - y);
y = .5*ceil(x);
if (y == ceil(y))