SCCS-vsn: lib/libm/common_source/acosh.c 1.5
SCCS-vsn: lib/libm/common_source/asincos.c 1.4
SCCS-vsn: lib/libm/common_source/asinh.c 1.4
SCCS-vsn: lib/libm/common_source/atanh.c 1.4
SCCS-vsn: lib/libm/common_source/cosh.c 1.6
SCCS-vsn: lib/libm/common_source/exp.c 1.8
SCCS-vsn: lib/libm/common_source/exp__E.c 1.6
SCCS-vsn: lib/libm/common_source/expm1.c 1.6
SCCS-vsn: lib/libm/common_source/floor.c 1.6
SCCS-vsn: lib/libm/common_source/j0.c 1.3
SCCS-vsn: lib/libm/common_source/j1.c 1.4
SCCS-vsn: lib/libm/common_source/jn.c 1.4
SCCS-vsn: lib/libm/common_source/lgamma.c 1.4
SCCS-vsn: lib/libm/common_source/log.c 1.6
SCCS-vsn: lib/libm/common_source/log10.c 1.5
SCCS-vsn: lib/libm/common_source/log1p.c 1.6
SCCS-vsn: lib/libm/common_source/log__L.c 1.5
SCCS-vsn: lib/libm/common_source/pow.c 1.7
SCCS-vsn: lib/libm/common_source/sinh.c 1.6
SCCS-vsn: lib/libm/common_source/tanh.c 1.4
SCCS-vsn: lib/libm/Makefile 1.6
SCCS-vsn: lib/libm/common/atan2.c 1.6
SCCS-vsn: lib/libm/ieee/cabs.c 1.6
SCCS-vsn: lib/libm/common/trig.c 1.7
SCCS-vsn: lib/libm/common/Makefile 1.2
SCCS-vsn: lib/libm/ieee/Makefile 1.5
SCCS-vsn: lib/libm/ieee/cbrt.c 1.4
SCCS-vsn: lib/libm/ieee/support.c 1.10
SCCS-vsn: lib/libm/national/Makefile 1.4
SCCS-vsn: lib/libm/vax/Makefile 1.4
30 files changed:
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
-# @(#)Makefile 1.5 (ucb.elefunt) %G%
+# @(#)Makefile 1.6 (ucb.elefunt) %G%
#
# This high quality math library is intended to run on either a VAX in
# D_floating format or a machine that conforms to the IEEE standard 754
#
# This high quality math library is intended to run on either a VAX in
# D_floating format or a machine that conforms to the IEEE standard 754
# MACHINE indicates the type of floating point hardware you are using; legal
# values are:
#
# MACHINE indicates the type of floating point hardware you are using; legal
# values are:
#
-# VAX - for the VAX D_floating format, the default.
-# TAHOE - for the TAHOE double format.
-# NATIONAL - for those IEEE machines whose floating point implementation
+# vax - for the VAX D_floating format, the default.
+# tahoe - for the TAHOE double format.
+# national - for those IEEE machines whose floating point implementation
# has similar byte ordering as the NATIONAL 32016 with 32081.
# has similar byte ordering as the NATIONAL 32016 with 32081.
-# IEEE - for other IEEE machines, we hope.
+# ieee - for other IEEE machines, we hope.
#
CFLAGS= -O -D${MACHINE}
LIBC= /lib/libc.a
#
CFLAGS= -O -D${MACHINE}
LIBC= /lib/libc.a
cd profiled; ar cru ../libm_p.a ${OBJS}
ar cru libm.a ${OBJS}
cd profiled; ar cru ../libm_p.a ${OBJS}
ar cru libm.a ${OBJS}
-more.IEEE: FRC
- cd COMMON; make "CFLAGS=${CFLAGS}"
- cd IEEE; make "CFLAGS=${CFLAGS}"
+more.ieee: FRC
+ cd common; make "CFLAGS=${CFLAGS}"
+ cd ieee; make "CFLAGS=${CFLAGS}"
-more.NATIONAL: FRC
- cd COMMON; make "CFLAGS=${CFLAGS}"
- cd NATIONAL; make "CFLAGS=${CFLAGS}"
+more.national: FRC
+ cd common; make "CFLAGS=${CFLAGS}"
+ cd national; make "CFLAGS=${CFLAGS}"
-more.TAHOE: FRC
- cd COMMON; make "CFLAGS=${CFLAGS}"
- cd TAHOE; make "CFLAGS=${CFLAGS}"
+more.tahoe: FRC
+ cd common; make "CFLAGS=${CFLAGS}"
+ cd tahoe; make "CFLAGS=${CFLAGS}"
-more.VAX: FRC
- cd VAX; make "CFLAGS=${CFLAGS}"
+more.vax: FRC
+ cd vax; make "CFLAGS=${CFLAGS}"
- rm -f ${OBJS} core libm.a libm_p.a COMMON/*.o IEEE/*.o NATIONAL/*.o TAHOE/*.o VAX/*.o profiled/*.o
+ rm -f ${OBJS} core libm.a libm_p.a common/*.o ieee/*.o national/*.o tahoe/*.o vax/*.o profiled/*.o
depend: FRC
mkdep ${CFLAGS} ${SRCS}
depend: FRC
mkdep ${CFLAGS} ${SRCS}
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
-# @(#)Makefile 1.1 (ucb.elefunt) %G%
+# @(#)Makefile 1.2 (ucb.elefunt) %G%
#
CFLAGS= -O
LIBC= /lib/libc.a
#
CFLAGS= -O
LIBC= /lib/libc.a
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)atan2.c 1.3 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)atan2.c 1.3 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* ATAN2(Y,X)
* RETURN ARG (X+iY)
/* ATAN2(Y,X)
* RETURN ARG (X+iY)
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/*static double */
/*athfhi = 4.6364760900080611433E-1 , /*Hex 2^ -1 * .ED63382B0DDA7B */
/*athflo = 1.9338828231967579916E-19 , /*Hex 2^-62 * .E450059CFE92C0 */
/*static double */
/*athfhi = 4.6364760900080611433E-1 , /*Hex 2^ -1 * .ED63382B0DDA7B */
/*athflo = 1.9338828231967579916E-19 , /*Hex 2^-62 * .E450059CFE92C0 */
#define a11 (*(double *)a11x)
static long a12x[] = { _0x(731a,bd6f), _0x(76d9,2f34)};
#define a12 (*(double *)a12x)
#define a11 (*(double *)a11x)
static long a12x[] = { _0x(731a,bd6f), _0x(76d9,2f34)};
#define a12 (*(double *)a12x)
+#else /* defined(vax)||defined(tahoe) */
static double
athfhi = 4.6364760900080609352E-1 , /*Hex 2^ -2 * 1.DAC670561BB4F */
athflo = 4.6249969567426939759E-18 , /*Hex 2^-58 * 1.5543B8F253271 */
static double
athfhi = 4.6364760900080609352E-1 , /*Hex 2^ -2 * 1.DAC670561BB4F */
athflo = 4.6249969567426939759E-18 , /*Hex 2^-58 * 1.5543B8F253271 */
a9 = 4.9850617156082015213E-2 , /*Hex 2^ -5 * 1.9860524BDD807 */
a10 = -3.6700606902093604877E-2 , /*Hex 2^ -5 * -1.2CA6C04C6937A */
a11 = 1.6438029044759730479E-2 ; /*Hex 2^ -6 * 1.0D52174A1BB54 */
a9 = 4.9850617156082015213E-2 , /*Hex 2^ -5 * 1.9860524BDD807 */
a10 = -3.6700606902093604877E-2 , /*Hex 2^ -5 * -1.2CA6C04C6937A */
a11 = 1.6438029044759730479E-2 ; /*Hex 2^ -6 * 1.0D52174A1BB54 */
+#endif /* defined(vax)||defined(tahoe) */
double atan2(y,x)
double y,x;
double atan2(y,x)
double y,x;
double copysign(),logb(),scalb(),t,z,signy,signx,hi,lo;
int finite(), k,m;
double copysign(),logb(),scalb(),t,z,signy,signx,hi,lo;
int finite(), k,m;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
/* if x or y is NAN */
if(x!=x) return(x); if(y!=y) return(y);
/* if x or y is NAN */
if(x!=x) return(x); if(y!=y) return(y);
+#endif /* !defined(vax)&&!defined(tahoe) */
/* copy down the sign of y and x */
signy = copysign(one,y) ;
/* copy down the sign of y and x */
signy = copysign(one,y) ;
/* when x = 0 */
if(x==zero) return(copysign(PIo2,signy));
/* when x = 0 */
if(x==zero) return(copysign(PIo2,signy));
-#if (!defined(VAX)&&!defined(TAHOE))
/* when x is INF */
if(!finite(x))
if(!finite(y))
/* when x is INF */
if(!finite(x))
if(!finite(y))
/* when y is INF */
if(!finite(y)) return(copysign(PIo2,signy));
/* when y is INF */
if(!finite(y)) return(copysign(PIo2,signy));
/* compute y/x */
x=copysign(x,one);
/* compute y/x */
x=copysign(x,one);
/* compute atan(t) for t in [-.4375, .4375] */
z = t*t;
/* compute atan(t) for t in [-.4375, .4375] */
z = t*t;
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+
z*(a9+z*(a10+z*(a11+z*a12))))))))))));
z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+
z*(a9+z*(a10+z*(a11+z*a12))))))))))));
+#else /* defined(vax)||defined(tahoe) */
z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+
z*(a9+z*(a10+z*a11)))))))))));
z = t*(z*(a1+z*(a2+z*(a3+z*(a4+z*(a5+z*(a6+z*(a7+z*(a8+
z*(a9+z*(a10+z*a11)))))))))));
+#endif /* defined(vax)||defined(tahoe) */
z = lo - z; z += t; z += hi;
return(copysign((signx>zero)?z:PI-z,signy));
z = lo - z; z += t; z += hi;
return(copysign((signx>zero)?z:PI-z,signy));
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)trig.c 1.2 (Berkeley) 8/22/85; 1.6 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)trig.c 1.2 (Berkeley) 8/22/85; 1.7 (ucb.elefunt) %G%";
+#endif /* not lint */
/* SIN(X), COS(X), TAN(X)
* RETURN THE SINE, COSINE, AND TANGENT OF X RESPECTIVELY
/* SIN(X), COS(X), TAN(X)
* RETURN THE SINE, COSINE, AND TANGENT OF X RESPECTIVELY
-#if (defined(VAX)||defined(TAHOE))
-#ifdef VAX
+#if defined(vax)||defined(tahoe)
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/*thresh = 2.6117239648121182150E-1 , Hex 2^ -1 * .85B8636B026EA0 */
/*PIo4 = 7.8539816339744830676E-1 , Hex 2^ 0 * .C90FDAA22168C2 */
/*PIo2 = 1.5707963267948966135E0 , Hex 2^ 1 * .C90FDAA22168C2 */
/*thresh = 2.6117239648121182150E-1 , Hex 2^ -1 * .85B8636B026EA0 */
/*PIo4 = 7.8539816339744830676E-1 , Hex 2^ 0 * .C90FDAA22168C2 */
/*PIo2 = 1.5707963267948966135E0 , Hex 2^ 1 * .C90FDAA22168C2 */
#define PI (*(double*)PIx)
static long PI2x[] = { _0x(0fda,41c9), _0x(68c2,a221)};
#define PI2 (*(double*)PI2x)
#define PI (*(double*)PIx)
static long PI2x[] = { _0x(0fda,41c9), _0x(68c2,a221)};
#define PI2 (*(double*)PI2x)
+#else /* defined(vax)||defined(tahoe) */
static double
thresh = 2.6117239648121182150E-1 , /*Hex 2^ -2 * 1.0B70C6D604DD4 */
PIo4 = 7.8539816339744827900E-1 , /*Hex 2^ -1 * 1.921FB54442D18 */
static double
thresh = 2.6117239648121182150E-1 , /*Hex 2^ -2 * 1.0B70C6D604DD4 */
PIo4 = 7.8539816339744827900E-1 , /*Hex 2^ -1 * 1.921FB54442D18 */
PI3o4 = 2.3561944901923448370E0 , /*Hex 2^ 1 * 1.2D97C7F3321D2 */
PI = 3.1415926535897931160E0 , /*Hex 2^ 1 * 1.921FB54442D18 */
PI2 = 6.2831853071795862320E0 ; /*Hex 2^ 2 * 1.921FB54442D18 */
PI3o4 = 2.3561944901923448370E0 , /*Hex 2^ 1 * 1.2D97C7F3321D2 */
PI = 3.1415926535897931160E0 , /*Hex 2^ 1 * 1.921FB54442D18 */
PI2 = 6.2831853071795862320E0 ; /*Hex 2^ 2 * 1.921FB54442D18 */
static long fmaxx[] = { 0xffffffff, 0x7fefffff};
#define fmax (*(double*)fmaxx)
static long fmaxx[] = { 0xffffffff, 0x7fefffff};
#define fmax (*(double*)fmaxx)
-#endif /* NATIONAL */
-#endif
+#endif /* national */
+#endif /* defined(vax)||defined(tahoe) */
static double zero=0, one=1, negone= -1, half=1.0/2.0,
small=1E-10, /* 1+small**2==1; better values for small:
small = 1.5E-9 for VAX D
static double zero=0, one=1, negone= -1, half=1.0/2.0,
small=1E-10, /* 1+small**2==1; better values for small:
small = 1.5E-9 for VAX D
double x;
{
double copysign(),drem(),cos__C(),sin__S(),a,z,ss,cc,c;
double x;
{
double copysign(),drem(),cos__C(),sin__S(),a,z,ss,cc,c;
- int k;
-#if (!defined(VAX)&&!defined(TAHOE))
- extern int finite();
/* tan(NaN) and tan(INF) must be NaN */
/* tan(NaN) and tan(INF) must be NaN */
- if(!finite(x)) return(x-x);
-#endif
+ if(!finite(x)) return(x-x);
x=drem(x,PI); /* reduce x into [-PI/2, PI/2] */
a=copysign(x,one); /* ... = abs(x) */
if ( a >= PIo4 ) {k=1; x = copysign( PIo2 - a , x ); }
x=drem(x,PI); /* reduce x into [-PI/2, PI/2] */
a=copysign(x,one); /* ... = abs(x) */
if ( a >= PIo4 ) {k=1; x = copysign( PIo2 - a , x ); }
z = z*half ; /* Next get c = cos(x) accurately */
c = (z >= thresh )? half-((z-half)-cc) : one-(z-cc);
if (k==0) return ( x + (x*(z-(cc-ss)))/c ); /* sin/cos */
z = z*half ; /* Next get c = cos(x) accurately */
c = (z >= thresh )? half-((z-half)-cc) : one-(z-cc);
if (k==0) return ( x + (x*(z-(cc-ss)))/c ); /* sin/cos */
else if(x==0.0) return copysign(fmax,x); /* no inf on 32k */
else if(x==0.0) return copysign(fmax,x); /* no inf on 32k */
else return( c/(x+x*ss) ); /* ... cos/sin */
else return( c/(x+x*ss) ); /* ... cos/sin */
double x;
{
double copysign(),drem(),sin__S(),cos__C(),a,c,z;
double x;
{
double copysign(),drem(),sin__S(),cos__C(),a,c,z;
-#if (!defined(VAX)&&!defined(TAHOE))
- extern int finite();
/* sin(NaN) and sin(INF) must be NaN */
/* sin(NaN) and sin(INF) must be NaN */
- if(!finite(x)) return(x-x);
-#endif
+ if(!finite(x)) return(x-x);
x=drem(x,PI2); /* reduce x into [-PI, PI] */
a=copysign(x,one);
if( a >= PIo4 ) {
x=drem(x,PI2); /* reduce x into [-PI, PI] */
a=copysign(x,one);
if( a >= PIo4 ) {
double x;
{
double copysign(),drem(),sin__S(),cos__C(),a,c,z,s=1.0;
double x;
{
double copysign(),drem(),sin__S(),cos__C(),a,c,z,s=1.0;
-#if (!defined(VAX)&&!defined(TAHOE))
- extern int finite();
/* cos(NaN) and cos(INF) must be NaN */
/* cos(NaN) and cos(INF) must be NaN */
- if(!finite(x)) return(x-x);
-#endif
+ if(!finite(x)) return(x-x);
x=drem(x,PI2); /* reduce x into [-PI, PI] */
a=copysign(x,one);
if ( a >= PIo4 ) {
x=drem(x,PI2); /* reduce x into [-PI, PI] */
a=copysign(x,one);
if ( a >= PIo4 ) {
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
/*S0 = -1.6666666666666646660E-1 , Hex 2^ -2 * -.AAAAAAAAAAAA71 */
/*S1 = 8.3333333333297230413E-3 , Hex 2^ -6 * .8888888888477F */
/*S2 = -1.9841269838362403710E-4 , Hex 2^-12 * -.D00D00CF8A1057 */
/*S0 = -1.6666666666666646660E-1 , Hex 2^ -2 * -.AAAAAAAAAAAA71 */
/*S1 = 8.3333333333297230413E-3 , Hex 2^ -6 * .8888888888477F */
/*S2 = -1.9841269838362403710E-4 , Hex 2^-12 * -.D00D00CF8A1057 */
static double sin__S(z)
double z;
{
static double sin__S(z)
double z;
{
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
return(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*(S5+z*S6)))))));
return(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*(S5+z*S6)))))));
+#else /* defined(vax)||defined(tahoe) */
return(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*S5))))));
return(z*(S0+z*(S1+z*(S2+z*(S3+z*(S4+z*S5))))));
+#endif /* defined(vax)||defined(tahoe) */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
/*C0 = 4.1666666666666504759E-2 , Hex 2^ -4 * .AAAAAAAAAAA9F0 */
/*C1 = -1.3888888888865302059E-3 , Hex 2^ -9 * -.B60B60B60A0CCA */
/*C2 = 2.4801587285601038265E-5 , Hex 2^-15 * .D00D00CDCD098F */
/*C0 = 4.1666666666666504759E-2 , Hex 2^ -4 * .AAAAAAAAAAA9F0 */
/*C1 = -1.3888888888865302059E-3 , Hex 2^ -9 * -.B60B60B60A0CCA */
/*C2 = 2.4801587285601038265E-5 , Hex 2^-15 * .D00D00CDCD098F */
#define C4 (*(double*)C4x)
static long C5x[] = { _0x(c32d,ae47), _0x(5a63,0a5c)};
#define C5 (*(double*)C5x)
#define C4 (*(double*)C4x)
static long C5x[] = { _0x(c32d,ae47), _0x(5a63,0a5c)};
#define C5 (*(double*)C5x)
+#else /* defined(vax)||defined(tahoe) */
static double
C0 = 4.1666666666666504759E-2 , /*Hex 2^ -5 * 1.555555555553E */
C1 = -1.3888888888865301516E-3 , /*Hex 2^-10 * -1.6C16C16C14199 */
static double
C0 = 4.1666666666666504759E-2 , /*Hex 2^ -5 * 1.555555555553E */
C1 = -1.3888888888865301516E-3 , /*Hex 2^-10 * -1.6C16C16C14199 */
C3 = -2.7557304623183959811E-7 , /*Hex 2^-22 * -1.27E4F1314AD1A */
C4 = 2.0873958177697780076E-9 , /*Hex 2^-29 * 1.1EE3B60DDDC8C */
C5 = -1.1250289076471311557E-11 ; /*Hex 2^-37 * -1.8BD5986B2A52E */
C3 = -2.7557304623183959811E-7 , /*Hex 2^-22 * -1.27E4F1314AD1A */
C4 = 2.0873958177697780076E-9 , /*Hex 2^-29 * 1.1EE3B60DDDC8C */
C5 = -1.1250289076471311557E-11 ; /*Hex 2^-37 * -1.8BD5986B2A52E */
+#endif /* defined(vax)||defined(tahoe) */
static double cos__C(z)
double z;
static double cos__C(z)
double z;
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)acosh.c 1.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)acosh.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
+#endif /* not lint */
/* ACOSH(X)
* RETURN THE INVERSE HYPERBOLIC COSINE OF X
* DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS)
/* ACOSH(X)
* RETURN THE INVERSE HYPERBOLIC COSINE OF X
* DOUBLE PRECISION (VAX D FORMAT 56 BITS, IEEE DOUBLE 53 BITS)
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */
static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)};
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)};
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */
+#endif /* defined(vax)||defined(tahoe) */
double acosh(x)
double x;
{
double log1p(),sqrt(),t,big=1.E20; /* big+1==big */
double acosh(x)
double x;
{
double log1p(),sqrt(),t,big=1.E20; /* big+1==big */
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
/* return log1p(x) + log(2) if x is large */
if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);}
/* return log1p(x) + log(2) if x is large */
if(x>big) {t=log1p(x)+ln2lo; return(t+ln2hi);}
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)asincos.c 1.1 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)asincos.c 1.1 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/* ASIN(X)
* RETURNS ARC SINE OF X
/* ASIN(X)
* RETURNS ARC SINE OF X
double x;
{
double s,t,copysign(),atan2(),sqrt(),one=1.0;
double x;
{
double s,t,copysign(),atan2(),sqrt(),one=1.0;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
s=copysign(x,one);
if(s <= 0.5)
return(atan2(x,sqrt(one-x*x)));
s=copysign(x,one);
if(s <= 0.5)
return(atan2(x,sqrt(one-x*x)));
double x;
{
double t,copysign(),atan2(),sqrt(),one=1.0;
double x;
{
double t,copysign(),atan2(),sqrt(),one=1.0;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
+#endif /* !defined(vax)&&!defined(tahoe) */
if( x != -1.0)
t=atan2(sqrt((one-x)/(one+x)),one);
else
if( x != -1.0)
t=atan2(sqrt((one-x)/(one+x)),one);
else
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)asinh.c 1.2 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)asinh.c 1.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/* ASINH(X)
* RETURN THE INVERSE HYPERBOLIC SINE OF X
/* ASINH(X)
* RETURN THE INVERSE HYPERBOLIC SINE OF X
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX/TAHOE D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 ; Hex 2^-39 * .E7BCD5E4F1D9CC */
static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)};
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
static long ln2lox[] = { _0x(bcd5,2ce7), _0x(d9cc,e4f1)};
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 ; /*Hex 2^-33 * 1.A39EF35793C76 */
+#endif /* defined(vax)||defined(tahoe) */
double asinh(x)
double x;
double asinh(x)
double x;
big =1.0E20, /* fl(1+big) == big */
one =1.0 ;
big =1.0E20, /* fl(1+big) == big */
one =1.0 ;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if((t=copysign(x,one))>small)
if(t<big) {
s=one/t; return(copysign(log1p(t+t/(s+sqrt(one+s*s))),x)); }
if((t=copysign(x,one))>small)
if(t<big) {
s=one/t; return(copysign(log1p(t+t/(s+sqrt(one+s*s))),x)); }
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)atanh.c 1.2 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)atanh.c 1.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/* ATANH(X)
* RETURN THE HYPERBOLIC ARC TANGENT OF X
/* ATANH(X)
* RETURN THE HYPERBOLIC ARC TANGENT OF X
* observed error was 1.87 ulps (units in the last place) at
* x= -3.8962076028810414000e-03.
*/
* observed error was 1.87 ulps (units in the last place) at
* x= -3.8962076028810414000e-03.
*/
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#endif /* defined(vax)||defined(tahoe) */
double atanh(x)
double x;
double atanh(x)
double x;
double copysign(),log1p(),z;
z = copysign(0.5,x);
x = copysign(x,1.0);
double copysign(),log1p(),z;
z = copysign(0.5,x);
x = copysign(x,1.0);
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if (x == 1.0) {
extern double infnan();
return(copysign(1.0,z)*infnan(ERANGE)); /* sign(x)*INF */
}
if (x == 1.0) {
extern double infnan();
return(copysign(1.0,z)*infnan(ERANGE)); /* sign(x)*INF */
}
+#endif /* defined(vax)||defined(tahoe) */
x = x/(1.0-x);
return( z*log1p(x+x) );
}
x = x/(1.0-x);
return( z*log1p(x+x) );
}
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)cosh.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)cosh.c 1.2 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* COSH(X)
* RETURN THE HYPERBOLIC COSINE OF X
/* COSH(X)
* RETURN THE HYPERBOLIC COSINE OF X
-#if (defined(VAX)||defined(TAHOE))
-#ifdef VAX
+#if defined(vax)||defined(tahoe)
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */
/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */
/* static double */
/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */
/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */
#define mln2hi (*(double*)mln2hix)
#define mln2lo (*(double*)mln2lox)
#define lnovfl (*(double*)lnovflx)
#define mln2hi (*(double*)mln2hix)
#define mln2lo (*(double*)mln2lox)
#define lnovfl (*(double*)lnovflx)
+#else /* defined(vax)||defined(tahoe) */
static double
mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */
mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */
lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */
static double
mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */
mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */
lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */
+#endif /* defined(vax)||defined(tahoe) */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
static double half=1.0/2.0,one=1.0, small=1.0E-18; /* fl(1+small)==1 */
double scalb(),copysign(),exp(),exp__E(),t;
static double half=1.0/2.0,one=1.0, small=1.0E-18; /* fl(1+small)==1 */
double scalb(),copysign(),exp(),exp__E(),t;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if((x=copysign(x,one)) <= 22)
if(x<0.3465)
if(x<small) return(one+x);
if((x=copysign(x,one)) <= 22)
if(x<0.3465)
if(x<small) return(one+x);
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)exp.c 4.3 (Berkeley) 8/21/85; 1.7 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)exp.c 4.3 (Berkeley) 8/21/85; 1.8 (ucb.elefunt) %G%";
+#endif /* not lint */
/* EXP(X)
* RETURN THE EXPONENTIAL OF X
/* EXP(X)
* RETURN THE EXPONENTIAL OF X
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
#define p4 (*(double*)p4x)
#define p5 (*(double*)p5x)
#define p4 (*(double*)p4x)
#define p5 (*(double*)p5x)
+#else /* defined(vax)||defined(tahoe) */
static double
p1 = 1.6666666666666601904E-1 , /*Hex 2^-3 * 1.555555555553E */
p2 = -2.7777777777015593384E-3 , /*Hex 2^-9 * -1.6C16C16BEBD93 */
static double
p1 = 1.6666666666666601904E-1 , /*Hex 2^-3 * 1.555555555553E */
p2 = -2.7777777777015593384E-3 , /*Hex 2^-9 * -1.6C16C16BEBD93 */
lnhuge = 7.1602103751842355450E2 , /*Hex 2^ 9 * 1.6602B15B7ECF2 */
lntiny = -7.5137154372698068983E2 , /*Hex 2^ 9 * -1.77AF8EBEAE354 */
invln2 = 1.4426950408889633870E0 ; /*Hex 2^ 0 * 1.71547652B82FE */
lnhuge = 7.1602103751842355450E2 , /*Hex 2^ 9 * 1.6602B15B7ECF2 */
lntiny = -7.5137154372698068983E2 , /*Hex 2^ 9 * -1.77AF8EBEAE354 */
invln2 = 1.4426950408889633870E0 ; /*Hex 2^ 0 * 1.71547652B82FE */
+#endif /* defined(vax)||defined(tahoe) */
double scalb(), copysign(), z,hi,lo,c;
int k,finite();
double scalb(), copysign(), z,hi,lo,c;
int k,finite();
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if( x <= lnhuge ) {
if( x >= lntiny ) {
if( x <= lnhuge ) {
if( x >= lntiny ) {
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)exp__E.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)exp__E.c 1.2 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* exp__E(x,c)
* ASSUMPTION: c << x SO THAT fl(x+c)=x.
/* exp__E(x,c)
* ASSUMPTION: c << x SO THAT fl(x+c)=x.
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* p1 = 1.5150724356786683059E-2 , Hex 2^ -6 * .F83ABE67E1066A */
/* p2 = 6.3112487873718332688E-5 , Hex 2^-13 * .845B4248CD0173 */
/* static double */
/* p1 = 1.5150724356786683059E-2 , Hex 2^ -6 * .F83ABE67E1066A */
/* p2 = 6.3112487873718332688E-5 , Hex 2^-13 * .845B4248CD0173 */
#define q1 (*(double*)q1x)
#define q2 (*(double*)q2x)
#define q3 (*(double*)q3x)
#define q1 (*(double*)q1x)
#define q2 (*(double*)q2x)
#define q3 (*(double*)q3x)
+#else /* defined(vax)||defined(tahoe) */
static double
p1 = 1.3887401997267371720E-2 , /*Hex 2^ -7 * 1.C70FF8B3CC2CF */
p2 = 3.3044019718331897649E-5 , /*Hex 2^-15 * 1.15317DF4526C4 */
q1 = 1.1110813732786649355E-1 , /*Hex 2^ -4 * 1.C719538248597 */
q2 = 9.9176615021572857300E-4 ; /*Hex 2^-10 * 1.03FC4CB8C98E8 */
static double
p1 = 1.3887401997267371720E-2 , /*Hex 2^ -7 * 1.C70FF8B3CC2CF */
p2 = 3.3044019718331897649E-5 , /*Hex 2^-15 * 1.15317DF4526C4 */
q1 = 1.1110813732786649355E-1 , /*Hex 2^ -4 * 1.C719538248597 */
q2 = 9.9176615021572857300E-4 ; /*Hex 2^-10 * 1.03FC4CB8C98E8 */
+#endif /* defined(vax)||defined(tahoe) */
double exp__E(x,c)
double x,c;
double exp__E(x,c)
double x,c;
if(copysign(x,one)>small) {
z = x*x ;
p = z*( p1 +z* p2 );
if(copysign(x,one)>small) {
z = x*x ;
p = z*( p1 +z* p2 );
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
q = z*( q1 +z*( q2 +z* q3 ));
q = z*( q1 +z*( q2 +z* q3 ));
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
xp= x*p ;
xh= x*half ;
w = xh-(q-xp) ;
xp= x*p ;
xh= x*half ;
w = xh-(q-xp) ;
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)expm1.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)expm1.c 1.2 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* EXPM1(X)
* RETURN THE EXPONENTIAL OF X MINUS ONE
/* EXPM1(X)
* RETURN THE EXPONENTIAL OF X MINUS ONE
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
#define ln2lo (*(double*)ln2lox)
#define lnhuge (*(double*)lnhugex)
#define invln2 (*(double*)invln2x)
#define ln2lo (*(double*)ln2lox)
#define lnhuge (*(double*)lnhugex)
#define invln2 (*(double*)invln2x)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
lnhuge = 7.1602103751842355450E2 , /*Hex 2^ 9 * 1.6602B15B7ECF2 */
invln2 = 1.4426950408889633870E0 ; /*Hex 2^ 0 * 1.71547652B82FE */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
lnhuge = 7.1602103751842355450E2 , /*Hex 2^ 9 * 1.6602B15B7ECF2 */
invln2 = 1.4426950408889633870E0 ; /*Hex 2^ 0 * 1.71547652B82FE */
+#endif /* defined(vax)||defined(tahoe) */
double expm1(x)
double x;
double expm1(x)
double x;
static double one=1.0, half=1.0/2.0;
double scalb(), copysign(), exp__E(), z,hi,lo,c;
int k,finite();
static double one=1.0, half=1.0/2.0;
double scalb(), copysign(), exp__E(), z,hi,lo,c;
int k,finite();
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
-#endif
-#if (!defined(VAX)&&!defined(TAHOE))
+#endif /* defined(vax)||defined(tahoe) */
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if( x <= lnhuge ) {
if( x >= -40.0 ) {
if( x <= lnhuge ) {
if( x >= -40.0 ) {
-/* @(#)floor.c 4.2 9/11/85; 1.5 (ucb.elefunt) %G% */
+/* @(#)floor.c 4.2 9/11/85; 1.6 (ucb.elefunt) %G% */
/*
* floor and ceil-- greatest integer <= arg
/*
* floor and ceil-- greatest integer <= arg
-#ifndef NATIONAL /* rint() is in ./NATIONAL/support.s */
+#ifndef national /* rint() is in ./NATIONAL/support.s */
/*
* algorithm for rint(x) in pseudo-pascal form ...
*
/*
* algorithm for rint(x) in pseudo-pascal form ...
*
* Note: Inexact will be signaled if x is not an integer, as is
* customary for IEEE 754. No other signal can be emitted.
*/
* Note: Inexact will be signaled if x is not an integer, as is
* customary for IEEE 754. No other signal can be emitted.
*/
-#if (defined(VAX)||defined(TAHOE))
-#ifdef VAX
+#if defined(vax)||defined(tahoe)
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
static long Lx[] = {_0x(0000,5c00),_0x(0000,0000)}; /* 2**55 */
#define L *(double *) Lx
static long Lx[] = {_0x(0000,5c00),_0x(0000,0000)}; /* 2**55 */
#define L *(double *) Lx
+#else /* defined(vax)||defined(tahoe) */
static double L = 4503599627370496.0E0; /* 2**52 */
static double L = 4503599627370496.0E0; /* 2**52 */
+#endif /* defined(vax)||defined(tahoe) */
double
rint(x)
double x;
{
double s,t,one = 1.0,copysign();
double
rint(x)
double x;
{
double s,t,one = 1.0,copysign();
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if (x != x) /* NaN */
return (x);
if (x != x) /* NaN */
return (x);
+#endif /* !defined(vax)&&!defined(tahoe) */
if (copysign(x,one) >= L) /* already an integer */
return (x);
s = copysign(L,x);
t = x + s; /* x+s rounded to integer */
return (t - s);
}
if (copysign(x,one) >= L) /* already an integer */
return (x);
s = copysign(L,x);
t = x + s; /* x+s rounded to integer */
return (t - s);
}
+#endif /* not national */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)j0.c 4.2 (Berkeley) 8/21/85; 1.2 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)j0.c 4.2 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
+#endif /* not lint */
/*
floating point Bessel's function
/*
floating point Bessel's function
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
static double zero = 0.e0;
static double zero = 0.e0;
+#endif /* defined(vax)||defined(tahoe) */
static double pzero, qzero;
static double tpi = .6366197723675813430755350535e0;
static double pio4 = .7853981633974483096156608458e0;
static double pzero, qzero;
static double tpi = .6366197723675813430755350535e0;
static double pio4 = .7853981633974483096156608458e0;
+#if defined(vax)||defined(tahoe)
extern double infnan();
return(infnan(EDOM)); /* NaN */
extern double infnan();
return(infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
return(zero/zero); /* IEEE machines: invalid operation */
return(zero/zero); /* IEEE machines: invalid operation */
+#endif /* defined(vax)||defined(tahoe) */
}
if(arg > 8.){
asympt(arg);
}
if(arg > 8.){
asympt(arg);
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)j1.c 4.2 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)j1.c 4.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/*
floating point Bessel's function
/*
floating point Bessel's function
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
static double zero = 0.e0;
static double zero = 0.e0;
+#endif /* defined(vax)||defined(tahoe) */
static double pzero, qzero;
static double tpi = .6366197723675813430755350535e0;
static double pio4 = .7853981633974483096156608458e0;
static double pzero, qzero;
static double tpi = .6366197723675813430755350535e0;
static double pio4 = .7853981633974483096156608458e0;
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
extern double infnan();
return(infnan(EDOM)); /* NaN */
extern double infnan();
return(infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
return(zero/zero); /* IEEE machines: invalid operation */
return(zero/zero); /* IEEE machines: invalid operation */
+#endif /* defined(vax)||defined(tahoe) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)jn.c 4.2 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)jn.c 4.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/*
floating point Bessel's function of
/*
floating point Bessel's function of
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
static double zero = 0.e0;
static double zero = 0.e0;
+#endif /* defined(vax)||defined(tahoe) */
double
jn(n,x) int n; double x;{
double
jn(n,x) int n; double x;{
double y0(), y1();
if (x <= 0) {
double y0(), y1();
if (x <= 0) {
+#if defined(vax)||defined(tahoe)
extern double infnan();
return(infnan(EDOM)); /* NaN */
extern double infnan();
return(infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
return(zero/zero); /* IEEE machines: invalid operation */
return(zero/zero); /* IEEE machines: invalid operation */
+#endif /* defined(vax)||defined(tahoe) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)lgamma.c 4.4 (Berkeley) 9/11/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)lgamma.c 4.4 (Berkeley) 9/11/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/*
C program for floating point log Gamma function
/*
C program for floating point log Gamma function
+#if defined(vax)||defined(tahoe)
+#endif /* defined(vax)||defined(tahoe) */
int signgam = 0;
static double goobie = 0.9189385332046727417803297; /* log(2*pi)/2 */
static double pi = 3.1415926535897932384626434;
int signgam = 0;
static double goobie = 0.9189385332046727417803297; /* log(2*pi)/2 */
static double pi = 3.1415926535897932384626434;
t = floor(arg);
if (arg - t > 0.5e0)
t += 1.e0; /* t := integer nearest arg */
t = floor(arg);
if (arg - t > 0.5e0)
t += 1.e0; /* t := integer nearest arg */
+#if defined(vax)||defined(tahoe)
if (arg == t) {
extern double infnan();
return(infnan(ERANGE)); /* +INF */
}
if (arg == t) {
extern double infnan();
return(infnan(ERANGE)); /* +INF */
}
+#endif /* defined(vax)||defined(tahoe) */
signgam = (int) (t - 2*floor(t/2)); /* signgam = 1 if t was odd, */
/* 0 if t was even */
signgam = signgam - 1 + signgam; /* signgam = 1 if t was odd, */
signgam = (int) (t - 2*floor(t/2)); /* signgam = 1 if t was odd, */
/* 0 if t was even */
signgam = signgam - 1 + signgam; /* signgam = 1 if t was odd, */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)log.c 4.5 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)log.c 4.5 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* LOG(X)
* RETURN THE LOGARITHM OF x
/* LOG(X)
* RETURN THE LOGARITHM OF x
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
+#if defined(vax)||defined(tahoe) /* VAX D format */
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
#define sqrt2 (*(double*)sqrt2x)
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
#define sqrt2 (*(double*)sqrt2x)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
+#endif /* defined(vax)||defined(tahoe) */
double logb(),scalb(),copysign(),log__L(),s,z,t;
int k,n,finite();
double logb(),scalb(),copysign(),log__L(),s,z,t;
int k,n,finite();
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if(finite(x)) {
if( x > zero ) {
if(finite(x)) {
if( x > zero ) {
/* end of if (x > zero) */
else {
/* end of if (x > zero) */
else {
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
extern double infnan();
if ( x == zero )
return (infnan(-ERANGE)); /* -INF */
else
return (infnan(EDOM)); /* NaN */
extern double infnan();
if ( x == zero )
return (infnan(-ERANGE)); /* -INF */
else
return (infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
/* zero argument, return -INF with signal */
if ( x == zero )
return( negone/zero );
/* zero argument, return -INF with signal */
if ( x == zero )
return( negone/zero );
/* negative argument, return NaN with signal */
else
return ( zero / zero );
/* negative argument, return NaN with signal */
else
return ( zero / zero );
+#endif /* defined(vax)||defined(tahoe) */
}
}
/* end of if (finite(x)) */
}
}
/* end of if (finite(x)) */
- /* NOT REACHED ifdef VAX */
+ /* NOTREACHED if defined(vax)||defined(tahoe) */
/* log(-INF) is NaN with signal */
else if (x<0)
/* log(-INF) is NaN with signal */
else if (x<0)
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)log10.c 1.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)log10.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
+#endif /* not lint */
/* LOG10(X)
* RETURN THE BASE 10 LOGARITHM OF x
/* LOG10(X)
* RETURN THE BASE 10 LOGARITHM OF x
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format (56 bits) */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format (56 bits) */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln10hi = 2.3025850929940456790E0 ; Hex 2^ 2 * .935D8DDDAAA8AC */
static long ln10hix[] = { _0x(5d8d,4113), _0x(a8ac,ddaa)};
#define ln10hi (*(double*)ln10hix)
/* static double */
/* ln10hi = 2.3025850929940456790E0 ; Hex 2^ 2 * .935D8DDDAAA8AC */
static long ln10hix[] = { _0x(5d8d,4113), _0x(a8ac,ddaa)};
#define ln10hi (*(double*)ln10hix)
+#else /* defined(vax)||defined(tahoe) */
static double
ivln10 = 4.3429448190325181667E-1 ; /*Hex 2^ -2 * 1.BCB7B1526E50E */
static double
ivln10 = 4.3429448190325181667E-1 ; /*Hex 2^ -2 * 1.BCB7B1526E50E */
+#endif /* defined(vax)||defined(tahoe) */
double log10(x)
double x;
{
double log();
double log10(x)
double x;
{
double log();
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)log1p.c 1.3 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)log1p.c 1.3 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* LOG1P(x)
* RETURN THE LOGARITHM OF 1+x
/* LOG1P(x)
* RETURN THE LOGARITHM OF 1+x
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
+#if defined(vax)||defined(tahoe) /* VAX D format */
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
#define sqrt2 (*(double*)sqrt2x)
#define ln2hi (*(double*)ln2hix)
#define ln2lo (*(double*)ln2lox)
#define sqrt2 (*(double*)sqrt2x)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
+#endif /* defined(vax)||defined(tahoe) */
double log1p(x)
double x;
double log1p(x)
double x;
double logb(),copysign(),scalb(),log__L(),z,s,t,c;
int k,finite();
double logb(),copysign(),scalb(),log__L(),z,s,t,c;
int k,finite();
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
if(finite(x)) {
if( x > negone ) {
if(finite(x)) {
if( x > negone ) {
/* end of if (x > negone) */
else {
/* end of if (x > negone) */
else {
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
extern double infnan();
if ( x == negone )
return (infnan(-ERANGE)); /* -INF */
else
return (infnan(EDOM)); /* NaN */
extern double infnan();
if ( x == negone )
return (infnan(-ERANGE)); /* -INF */
else
return (infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
/* x = -1, return -INF with signal */
if ( x == negone ) return( negone/zero );
/* negative argument for log, return NaN with signal */
else return ( zero / zero );
/* x = -1, return -INF with signal */
if ( x == negone ) return( negone/zero );
/* negative argument for log, return NaN with signal */
else return ( zero / zero );
+#endif /* defined(vax)||defined(tahoe) */
}
}
/* end of if (finite(x)) */
}
}
/* end of if (finite(x)) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)log__L.c 1.2 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)log__L.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
+#endif /* not lint */
/* log__L(Z)
* LOG(1+X) - 2S X
/* log__L(Z)
* LOG(1+X) - 2S X
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format (56 bits) */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format (56 bits) */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* L1 = 6.6666666666666703212E-1 , Hex 2^ 0 * .AAAAAAAAAAAAC5 */
/* L2 = 3.9999999999970461961E-1 , Hex 2^ -1 * .CCCCCCCCCC2684 */
/* static double */
/* L1 = 6.6666666666666703212E-1 , Hex 2^ 0 * .AAAAAAAAAAAAC5 */
/* L2 = 3.9999999999970461961E-1 , Hex 2^ -1 * .CCCCCCCCCC2684 */
#define L6 (*(double*)L6x)
#define L7 (*(double*)L7x)
#define L8 (*(double*)L8x)
#define L6 (*(double*)L6x)
#define L7 (*(double*)L7x)
#define L8 (*(double*)L8x)
+#else /* defined(vax)||defined(tahoe) */
static double
L1 = 6.6666666666667340202E-1 , /*Hex 2^ -1 * 1.5555555555592 */
L2 = 3.9999999999416702146E-1 , /*Hex 2^ -2 * 1.999999997FF24 */
static double
L1 = 6.6666666666667340202E-1 , /*Hex 2^ -1 * 1.5555555555592 */
L2 = 3.9999999999416702146E-1 , /*Hex 2^ -2 * 1.999999997FF24 */
L5 = 1.8183562745289935658E-1 , /*Hex 2^ -3 * 1.74663CC94342F */
L6 = 1.5314087275331442206E-1 , /*Hex 2^ -3 * 1.39A1EC014045B */
L7 = 1.4795612545334174692E-1 ; /*Hex 2^ -3 * 1.2F039F0085122 */
L5 = 1.8183562745289935658E-1 , /*Hex 2^ -3 * 1.74663CC94342F */
L6 = 1.5314087275331442206E-1 , /*Hex 2^ -3 * 1.39A1EC014045B */
L7 = 1.4795612545334174692E-1 ; /*Hex 2^ -3 * 1.2F039F0085122 */
+#endif /* defined(vax)||defined(tahoe) */
double log__L(z)
double z;
{
double log__L(z)
double z;
{
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8))))))));
return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*(L7+z*L8))))))));
+#else /* defined(vax)||defined(tahoe) */
return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7)))))));
return(z*(L1+z*(L2+z*(L3+z*(L4+z*(L5+z*(L6+z*L7)))))));
+#endif /* defined(vax)||defined(tahoe) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)pow.c 4.5 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)pow.c 4.5 (Berkeley) 8/21/85; 1.7 (ucb.elefunt) %G%";
+#endif /* not lint */
/* POW(X,Y)
* RETURN X**Y
/* POW(X,Y)
* RETURN X**Y
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
+#if defined(vax)||defined(tahoe) /* VAX D format */
#include <errno.h>
extern double infnan();
#include <errno.h>
extern double infnan();
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
/* static double */
/* ln2hi = 6.9314718055829871446E-1 , Hex 2^ 0 * .B17217F7D00000 */
/* ln2lo = 1.6465949582897081279E-12 , Hex 2^-39 * .E7BCD5E4F1D9CC */
#define ln2lo (*(double*)ln2lox)
#define invln2 (*(double*)invln2x)
#define sqrt2 (*(double*)sqrt2x)
#define ln2lo (*(double*)ln2lox)
#define invln2 (*(double*)invln2x)
#define sqrt2 (*(double*)sqrt2x)
+#else /* defined(vax)||defined(tahoe) */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
invln2 = 1.4426950408889633870E0 , /*Hex 2^ 0 * 1.71547652B82FE */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
static double
ln2hi = 6.9314718036912381649E-1 , /*Hex 2^ -1 * 1.62E42FEE00000 */
ln2lo = 1.9082149292705877000E-10 , /*Hex 2^-33 * 1.A39EF35793C76 */
invln2 = 1.4426950408889633870E0 , /*Hex 2^ 0 * 1.71547652B82FE */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
+#endif /* defined(vax)||defined(tahoe) */
static double zero=0.0, half=1.0/2.0, one=1.0, two=2.0, negone= -1.0;
static double zero=0.0, half=1.0/2.0, one=1.0, two=2.0, negone= -1.0;
if (y==zero) return(one);
else if(y==one
if (y==zero) return(one);
else if(y==one
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
+#endif /* !defined(vax)&&!defined(tahoe) */
) return( x ); /* if x is NaN or y=1 */
) return( x ); /* if x is NaN or y=1 */
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
else if(y!=y) return( y ); /* if y is NaN */
else if(y!=y) return( y ); /* if y is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
else if(!finite(y)) /* if y is INF */
if((t=copysign(x,one))==one) return(zero/zero);
else if(t>one) return((y>zero)?y:zero);
else if(!finite(y)) /* if y is INF */
if((t=copysign(x,one))==one) return(zero/zero);
else if(t>one) return((y>zero)?y:zero);
else if(x==zero) /* x is -0 */
return((y>zero)?-x:one/(-x));
else { /* return NaN */
else if(x==zero) /* x is -0 */
return((y>zero)?-x:one/(-x));
else { /* return NaN */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
return (infnan(EDOM)); /* NaN */
return (infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
{
double logb(),scalb(),copysign(),log__L(),exp__E();
double c,s,t,z,tx,ty;
{
double logb(),scalb(),copysign(),log__L(),exp__E();
double c,s,t,z,tx,ty;
float sx,sy;
long k=0;
int n,m;
if(x==zero||!finite(x)) { /* if x is +INF or +0 */
float sx,sy;
long k=0;
int n,m;
if(x==zero||!finite(x)) { /* if x is +INF or +0 */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
return((y>zero)?x:infnan(ERANGE)); /* if y<zero, return +INF */
return((y>zero)?x:infnan(ERANGE)); /* if y<zero, return +INF */
+#else /* defined(vax)||defined(tahoe) */
return((y>zero)?x:one/x);
return((y>zero)?x:one/x);
+#endif /* defined(vax)||defined(tahoe) */
}
if(x==1.0) return(x); /* if x=1.0, return 1 since y is finite */
/* reduce x to z in [sqrt(1/2)-1, sqrt(2)-1] */
z=scalb(x,-(n=logb(x)));
}
if(x==1.0) return(x); /* if x=1.0, return 1 since y is finite */
/* reduce x to z in [sqrt(1/2)-1, sqrt(2)-1] */
z=scalb(x,-(n=logb(x)));
-#if (!defined(VAX)&&!defined(TAHOE)) /* IEEE double; subnormal number */
+#if !defined(vax)&&!defined(tahoe) /* IEEE double; subnormal number */
if(n <= -1022) {n += (m=logb(z)); z=scalb(z,-m);}
if(n <= -1022) {n += (m=logb(z)); z=scalb(z,-m);}
+#endif /* !defined(vax)&&!defined(tahoe) */
if(z >= sqrt2 ) {n += 1; z *= half;} z -= one ;
/* log(x) = nlog2+log(1+z) ~ nlog2 + t + tx */
if(z >= sqrt2 ) {n += 1; z *= half;} z -= one ;
/* log(x) = nlog2+log(1+z) ~ nlog2 + t + tx */
/* end of checking whether k==y */
sy=y; ty=y-sy; /* y ~ sy + ty */
/* end of checking whether k==y */
sy=y; ty=y-sy; /* y ~ sy + ty */
s = (tahoe_tmp = sx)*sy-k*ln2hi;
s = (tahoe_tmp = sx)*sy-k*ln2hi;
s=(double)sx*sy-k*ln2hi; /* (sy+ty)*(sx+tx)-kln2 */
s=(double)sx*sy-k*ln2hi; /* (sy+ty)*(sx+tx)-kln2 */
z=(tx*ty-k*ln2lo);
tx=tx*sy; ty=sx*ty;
t=ty+z; t+=tx; t+=s;
z=(tx*ty-k*ln2lo);
tx=tx*sy; ty=sx*ty;
t=ty+z; t+=tx; t+=s;
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)sinh.c 4.3 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)sinh.c 4.3 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* SINH(X)
* RETURN THE HYPERBOLIC SINE OF X
/* SINH(X)
* RETURN THE HYPERBOLIC SINE OF X
* from decimal to binary accurately enough to produce the hexadecimal values
* shown.
*/
* from decimal to binary accurately enough to produce the hexadecimal values
* shown.
*/
-#if (defined(VAX)||defined(TAHOE))
-#ifdef VAX
+#if defined(vax)||defined(tahoe)
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */
/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */
/* static double */
/* mln2hi = 8.8029691931113054792E1 , Hex 2^ 7 * .B00F33C7E22BDB */
/* mln2lo = -4.9650192275318476525E-16 , Hex 2^-50 * -.8F1B60279E582A */
#define mln2hi (*(double*)mln2hix)
#define mln2lo (*(double*)mln2lox)
#define lnovfl (*(double*)lnovflx)
#define mln2hi (*(double*)mln2hix)
#define mln2lo (*(double*)mln2lox)
#define lnovfl (*(double*)lnovflx)
+#else /* defined(vax)||defined(tahoe) */
static double
mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */
mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */
lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */
static double
mln2hi = 7.0978271289338397310E2 , /*Hex 2^ 10 * 1.62E42FEFA39EF */
mln2lo = 2.3747039373786107478E-14 , /*Hex 2^-45 * 1.ABC9E3B39803F */
lnovfl = 7.0978271289338397310E2 ; /*Hex 2^ 9 * 1.62E42FEFA39EF */
+#endif /* defined(vax)||defined(tahoe) */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
{
static double one=1.0, half=1.0/2.0 ;
double expm1(), t, scalb(), copysign(), sign;
{
static double one=1.0, half=1.0/2.0 ;
double expm1(), t, scalb(), copysign(), sign;
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
sign=copysign(one,x);
x=copysign(x,one);
if(x<lnovfl)
sign=copysign(one,x);
x=copysign(x,one);
if(x<lnovfl)
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)tanh.c 4.3 (Berkeley) 8/21/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)tanh.c 4.3 (Berkeley) 8/21/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/* TANH(X)
* RETURN THE HYPERBOLIC TANGENT OF X
/* TANH(X)
* RETURN THE HYPERBOLIC TANGENT OF X
double expm1(), t, copysign(), sign;
int finite();
double expm1(), t, copysign(), sign;
int finite();
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
if(x!=x) return(x); /* x is NaN */
if(x!=x) return(x); /* x is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
sign=copysign(one,x);
x=copysign(x,one);
sign=copysign(one,x);
x=copysign(x,one);
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
# All rights reserved. The Berkeley software License Agreement
# specifies the terms and conditions for redistribution.
#
-# @(#)Makefile 1.4 (ucb.elefunt) %G%
+# @(#)Makefile 1.5 (ucb.elefunt) %G%
#
CFLAGS= -O
LIBC= /lib/libc.a
#
CFLAGS= -O
LIBC= /lib/libc.a
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)cabs.c 1.2 (Berkeley) 8/21/85; 1.5 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)cabs.c 1.2 (Berkeley) 8/21/85; 1.6 (ucb.elefunt) %G%";
+#endif /* not lint */
/* CABS(Z)
* RETURN THE ABSOLUTE VALUE OF THE COMPLEX NUMBER Z = X + iY
/* CABS(Z)
* RETURN THE ABSOLUTE VALUE OF THE COMPLEX NUMBER Z = X + iY
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
-#ifdef VAX
+#if defined(vax)||defined(tahoe) /* VAX D format */
+#ifdef vax
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/A/**/B
#define _0x(A,B) 0x/**/B/**/A
#define _0x(A,B) 0x/**/B/**/A
/* static double */
/* r2p1hi = 2.4142135623730950345E0 , Hex 2^ 2 * .9A827999FCEF32 */
/* r2p1lo = 1.4349369327986523769E-17 , Hex 2^-55 * .84597D89B3754B */
/* static double */
/* r2p1hi = 2.4142135623730950345E0 , Hex 2^ 2 * .9A827999FCEF32 */
/* r2p1lo = 1.4349369327986523769E-17 , Hex 2^-55 * .84597D89B3754B */
#define r2p1hi (*(double*)r2p1hix)
#define r2p1lo (*(double*)r2p1lox)
#define sqrt2 (*(double*)sqrt2x)
#define r2p1hi (*(double*)r2p1hix)
#define r2p1lo (*(double*)r2p1lox)
#define sqrt2 (*(double*)sqrt2x)
-#else /* IEEE double format */
+#else /* defined(vax)||defined(tahoe) */
static double
r2p1hi = 2.4142135623730949234E0 , /*Hex 2^1 * 1.3504F333F9DE6 */
r2p1lo = 1.2537167179050217666E-16 , /*Hex 2^-53 * 1.21165F626CDD5 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
static double
r2p1hi = 2.4142135623730949234E0 , /*Hex 2^1 * 1.3504F333F9DE6 */
r2p1lo = 1.2537167179050217666E-16 , /*Hex 2^-53 * 1.21165F626CDD5 */
sqrt2 = 1.4142135623730951455E0 ; /*Hex 2^ 0 * 1.6A09E667F3BCD */
+#endif /* defined(vax)||defined(tahoe) */
double hypot(x,y)
double x, y;
double hypot(x,y)
double x, y;
double copysign(),scalb(),logb(),sqrt(),t,r;
int finite(), exp;
double copysign(),scalb(),logb(),sqrt(),t,r;
int finite(), exp;
-#if (!defined(VAX)&&!defined(TAHOE))
if(finite(x))
if(finite(y))
{
if(finite(x))
if(finite(y))
{
x=copysign(x,one);
y=copysign(y,one);
if(y > x)
x=copysign(x,one);
y=copysign(y,one);
if(y > x)
-#if (!defined(VAX)&&!defined(TAHOE))
}
else if(y==y) /* y is +-INF */
}
else if(y==y) /* y is +-INF */
return (copysign(x,one));
else if(finite(y))
return(x); /* x is NaN, y is finite */
return (copysign(x,one));
else if(finite(y))
return(x); /* x is NaN, y is finite */
+#if !defined(vax)&&!defined(tahoe)
else if(y!=y) return(y); /* x and y is NaN */
else if(y!=y) return(y); /* x and y is NaN */
+#endif /* !defined(vax)&&!defined(tahoe) */
else return(copysign(y,one)); /* y is INF */
else return(copysign(y,one)); /* y is INF */
}
/* A faster but less accurate version of cabs(x,y) */
}
/* A faster but less accurate version of cabs(x,y) */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)cbrt.c 1.1 (Berkeley) 5/23/85; 1.3 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)cbrt.c 1.1 (Berkeley) 5/23/85; 1.4 (ucb.elefunt) %G%";
+#endif /* not lint */
/* kahan's cube root (53 bits IEEE double precision)
* for IEEE machines only
/* kahan's cube root (53 bits IEEE double precision)
* for IEEE machines only
* On a National machine, it has different ordering; therefore, this code
* must be compiled with flag -DNATIONAL.
*/
* On a National machine, it has different ordering; therefore, this code
* must be compiled with flag -DNATIONAL.
*/
-#if (!defined(VAX)&&!defined(TAHOE))
+#if !defined(vax)&&!defined(tahoe)
static unsigned long B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */
B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */
static unsigned long B1 = 715094163, /* B1 = (682-0.03306235651)*2**20 */
B2 = 696219795; /* B2 = (664-0.03306235651)*2**20 */
*pt = (unsigned long *) &t,
mexp,sign;
*pt = (unsigned long *) &t,
mexp,sign;
-#ifdef NATIONAL /* ordering of words in a floating points number */
+#ifdef national /* ordering of words in a floating points number */
mexp=px[n0]&0x7ff00000;
if(mexp==0x7ff00000) return(x); /* cbrt(NaN,INF) is itself */
mexp=px[n0]&0x7ff00000;
if(mexp==0x7ff00000) return(x); /* cbrt(NaN,INF) is itself */
#ifndef lint
static char sccsid[] =
#ifndef lint
static char sccsid[] =
-"@(#)support.c 1.1 (Berkeley) 5/23/85; 1.9 (ucb.elefunt) %G%";
-#endif not lint
+"@(#)support.c 1.1 (Berkeley) 5/23/85; 1.10 (ucb.elefunt) %G%";
+#endif /* not lint */
/*
* Some IEEE standard 754 recommended functions and remainder and sqrt for
/*
* Some IEEE standard 754 recommended functions and remainder and sqrt for
-#if (defined(VAX)||defined(TAHOE)) /* VAX D format */
+#if defined(vax)||defined(tahoe) /* VAX D format */
#include <errno.h>
static unsigned short msign=0x7fff , mexp =0x7f80 ;
static short prep1=57, gap=7, bias=129 ;
static double novf=1.7E38, nunf=3.0E-39, zero=0.0 ;
#include <errno.h>
static unsigned short msign=0x7fff , mexp =0x7f80 ;
static short prep1=57, gap=7, bias=129 ;
static double novf=1.7E38, nunf=3.0E-39, zero=0.0 ;
-#else /*IEEE double format */
+#else /* defined(vax)||defined(tahoe) */
static unsigned short msign=0x7fff, mexp =0x7ff0 ;
static short prep1=54, gap=4, bias=1023 ;
static double novf=1.7E308, nunf=3.0E-308,zero=0.0;
static unsigned short msign=0x7fff, mexp =0x7ff0 ;
static short prep1=54, gap=4, bias=1023 ;
static double novf=1.7E308, nunf=3.0E-308,zero=0.0;
+#endif /* defined(vax)||defined(tahoe) */
double scalb(x,N)
double x; int N;
double scalb(x,N)
double x; int N;
unsigned short *px=(unsigned short *) &x + 3;
unsigned short *px=(unsigned short *) &x + 3;
-#else /* VAX, SUN, ZILOG, TAHOE */
unsigned short *px=(unsigned short *) &x;
unsigned short *px=(unsigned short *) &x;
if( x == zero ) return(x);
if( x == zero ) return(x);
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if( (k= *px & mexp ) != ~msign ) {
if (N < -260)
return(nunf*nunf);
if( (k= *px & mexp ) != ~msign ) {
if (N < -260)
return(nunf*nunf);
extern double infnan(),copysign();
return(copysign(infnan(ERANGE),x));
}
extern double infnan(),copysign();
return(copysign(infnan(ERANGE),x));
}
+#else /* defined(vax)||defined(tahoe) */
if( (k= *px & mexp ) != mexp ) {
if( N<-2100) return(nunf*nunf); else if(N>2100) return(novf+novf);
if( k == 0 ) {
x *= scalb(1.0,(int)prep1); N -= prep1; return(scalb(x,N));}
if( (k= *px & mexp ) != mexp ) {
if( N<-2100) return(nunf*nunf); else if(N>2100) return(novf+novf);
if( k == 0 ) {
x *= scalb(1.0,(int)prep1); N -= prep1; return(scalb(x,N));}
+#endif /* defined(vax)||defined(tahoe) */
if((k = (k>>gap)+ N) > 0 )
if( k < (mexp>>gap) ) *px = (*px&~mexp) | (k<<gap);
if((k = (k>>gap)+ N) > 0 )
if( k < (mexp>>gap) ) *px = (*px&~mexp) | (k<<gap);
double copysign(x,y)
double x,y;
{
double copysign(x,y)
double x,y;
{
unsigned short *px=(unsigned short *) &x+3,
*py=(unsigned short *) &y+3;
unsigned short *px=(unsigned short *) &x+3,
*py=(unsigned short *) &y+3;
-#else /* VAX, SUN, ZILOG,TAHOE */
unsigned short *px=(unsigned short *) &x,
*py=(unsigned short *) &y;
unsigned short *px=(unsigned short *) &x,
*py=(unsigned short *) &y;
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if ( (*px & mexp) == 0 ) return(x);
if ( (*px & mexp) == 0 ) return(x);
+#endif /* defined(vax)||defined(tahoe) */
*px = ( *px & msign ) | ( *py & ~msign );
return(x);
*px = ( *px & msign ) | ( *py & ~msign );
return(x);
short *px=(short *) &x+3, k;
short *px=(short *) &x+3, k;
-#else /* VAX, SUN, ZILOG, TAHOE */
short *px=(short *) &x, k;
short *px=(short *) &x, k;
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
return (int)(((*px&mexp)>>gap)-bias);
return (int)(((*px&mexp)>>gap)-bias);
+#else /* defined(vax)||defined(tahoe) */
if( (k= *px & mexp ) != mexp )
if ( k != 0 )
return ( (k>>gap) - bias );
if( (k= *px & mexp ) != mexp )
if ( k != 0 )
return ( (k>>gap) - bias );
return(x);
else
{*px &= msign; return(x);}
return(x);
else
{*px &= msign; return(x);}
+#endif /* defined(vax)||defined(tahoe) */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
-#else /* IEEE */
-#ifdef NATIONAL
+#else /* defined(vax)||defined(tahoe) */
+#ifdef national
return( (*((short *) &x+3 ) & mexp ) != mexp );
return( (*((short *) &x+3 ) & mexp ) != mexp );
return( (*((short *) &x ) & mexp ) != mexp );
return( (*((short *) &x ) & mexp ) != mexp );
+#endif /* national */
+#endif /* defined(vax)||defined(tahoe) */
short sign;
double hp,dp,tmp,drem(),scalb();
unsigned short k;
short sign;
double hp,dp,tmp,drem(),scalb();
unsigned short k;
unsigned short
*px=(unsigned short *) &x +3,
*pp=(unsigned short *) &p +3,
*pd=(unsigned short *) &dp +3,
*pt=(unsigned short *) &tmp+3;
unsigned short
*px=(unsigned short *) &x +3,
*pp=(unsigned short *) &p +3,
*pd=(unsigned short *) &dp +3,
*pt=(unsigned short *) &tmp+3;
-#else /* VAX, SUN, ZILOG, TAHOE */
unsigned short
*px=(unsigned short *) &x ,
*pp=(unsigned short *) &p ,
*pd=(unsigned short *) &dp ,
*pt=(unsigned short *) &tmp;
unsigned short
*px=(unsigned short *) &x ,
*pp=(unsigned short *) &p ,
*pd=(unsigned short *) &dp ,
*pt=(unsigned short *) &tmp;
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if( ( *px & mexp ) == ~msign ) /* is x a reserved operand? */
if( ( *px & mexp ) == ~msign ) /* is x a reserved operand? */
+#else /* defined(vax)||defined(tahoe) */
if( ( *px & mexp ) == mexp )
if( ( *px & mexp ) == mexp )
+#endif /* defined(vax)||defined(tahoe) */
return (x-p)-(x-p); /* create nan if x is inf */
if (p == zero) {
return (x-p)-(x-p); /* create nan if x is inf */
if (p == zero) {
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
extern double infnan();
return(infnan(EDOM));
extern double infnan();
return(infnan(EDOM));
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if( ( *pp & mexp ) == ~msign ) /* is p a reserved operand? */
if( ( *pp & mexp ) == ~msign ) /* is p a reserved operand? */
+#else /* defined(vax)||defined(tahoe) */
if( ( *pp & mexp ) == mexp )
if( ( *pp & mexp ) == mexp )
+#endif /* defined(vax)||defined(tahoe) */
{ if (p != p) return p; else return x;}
else if ( ((*pp & mexp)>>gap) <= 1 )
{ if (p != p) return p; else return x;}
else if ( ((*pp & mexp)>>gap) <= 1 )
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
if( x < tmp ) *pt -= 128 ;
if( x < tmp ) *pt -= 128 ;
+#else /* defined(vax)||defined(tahoe) */
if( x < tmp ) *pt -= 16 ;
if( x < tmp ) *pt -= 16 ;
+#endif /* defined(vax)||defined(tahoe) */
x -= tmp ;
}
if ( x > hp )
{ x -= p ; if ( x >= hp ) x -= p ; }
x -= tmp ;
}
if ( x > hp )
{ x -= p ; if ( x >= hp ) x -= p ; }
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#endif /* defined(vax)||defined(tahoe) */
double logb(),scalb();
double t,zero=0.0;
int m,n,i,finite();
double logb(),scalb();
double t,zero=0.0;
int m,n,i,finite();
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
/* sqrt(NaN) is NaN, sqrt(+-0) = +-0 */
if(x!=x||x==zero) return(x);
/* sqrt(negative) is invalid */
if(x<zero) {
/* sqrt(NaN) is NaN, sqrt(+-0) = +-0 */
if(x!=x||x==zero) return(x);
/* sqrt(negative) is invalid */
if(x<zero) {
-#if (defined(VAX)||defined(TAHOE))
+#if defined(vax)||defined(tahoe)
extern double infnan();
return (infnan(EDOM)); /* NaN */
extern double infnan();
return (infnan(EDOM)); /* NaN */
+#else /* defined(vax)||defined(tahoe) */
+#endif /* defined(vax)||defined(tahoe) */
-#ifdef NATIONAL /* order of words in floating point number */
+#ifdef national /* order of words in floating point number */
static n0=3,n1=2,n2=1,n3=0;
#else /* VAX, SUN, ZILOG, TAHOE */
static n0=0,n1=1,n2=2,n3=3;
static n0=3,n1=2,n2=1,n3=0;
#else /* VAX, SUN, ZILOG, TAHOE */
static n0=0,n1=1,n2=2,n3=3;
unsigned long *py=(unsigned long *) &y ,
*pt=(unsigned long *) &t ,
*px=(unsigned long *) &x ;
unsigned long *py=(unsigned long *) &y ,
*pt=(unsigned long *) &t ,
*px=(unsigned long *) &x ;
-#ifdef NATIONAL /* ordering of word in a floating point number */
+#ifdef national /* ordering of word in a floating point number */
int n0=1, n1=0;
#else
int n0=0, n1=1;
int n0=1, n1=0;
#else
int n0=0, n1=1;
-# @(#)Makefile 1.3 (ucb.elefunt) %G%
-CFLAGS= -DNATIONAL -O
+# @(#)Makefile 1.4 (ucb.elefunt) %G%
+CFLAGS= -O
SRCS=cbrt.c sqrt.s support.s
OBJS=cbrt.o sqrt.o support.o
SRCS=cbrt.c sqrt.s support.s
OBJS=cbrt.o sqrt.o support.o
-# @(#)Makefile 1.3 (ucb.elefunt) %G%
-# SCCSID = "@(#)Makefile 1.3 (ucb.elefunt) %G%"
+# @(#)Makefile 1.4 (ucb.elefunt) %G%
MORE=atan2.o cabs.o cbrt.o sqrt.o sincos.o tan.o argred.o support.o infnan.o
.s.o:
MORE=atan2.o cabs.o cbrt.o sqrt.o sincos.o tan.o argred.o support.o infnan.o
.s.o: