Commit 242cef1e by Richard Stallman

Whitespace changes.

From-SVN: r5740
parent 7b18c3db
...@@ -2043,151 +2043,153 @@ emulm (a, b) ...@@ -2043,151 +2043,153 @@ emulm (a, b)
/* Multiply significand of e-type number b /* Multiply significand of e-type number b
by 16-bit quantity a, e-type result to c. */ by 16-bit quantity a, e-type result to c. */
void m16m( a, b, c ) void
unsigned short a; m16m (a, b, c)
unsigned short b[], c[]; unsigned short a;
unsigned short b[], c[];
{ {
register unsigned short *pp; register unsigned short *pp;
register unsigned long carry; register unsigned long carry;
unsigned short *ps; unsigned short *ps;
unsigned short p[NI]; unsigned short p[NI];
unsigned long aa, m; unsigned long aa, m;
int i; int i;
aa = a; aa = a;
pp = &p[NI-2]; pp = &p[NI-2];
*pp++ = 0; *pp++ = 0;
*pp = 0; *pp = 0;
ps = &b[NI-1]; ps = &b[NI-1];
for( i=M+1; i<NI; i++ ) for (i=M+1; i<NI; i++)
{
if (*ps == 0)
{ {
if( *ps == 0 ) --ps;
{ --pp;
--ps; *(pp-1) = 0;
--pp;
*(pp-1) = 0;
}
else
{
m = (unsigned long) aa * *ps--;
carry = (m & 0xffff) + *pp;
*pp-- = (unsigned short )carry;
carry = (carry >> 16) + (m >> 16) + *pp;
*pp = (unsigned short )carry;
*(pp-1) = carry >> 16;
}
} }
for( i=M; i<NI; i++ ) else
c[i] = p[i]; {
m = (unsigned long) aa * *ps--;
carry = (m & 0xffff) + *pp;
*pp-- = (unsigned short)carry;
carry = (carry >> 16) + (m >> 16) + *pp;
*pp = (unsigned short)carry;
*(pp-1) = carry >> 16;
}
}
for (i=M; i<NI; i++)
c[i] = p[i];
} }
/* Divide significands. Neither the numerator nor the denominator /* Divide significands. Neither the numerator nor the denominator
is permitted to have its high guard word nonzero. */ is permitted to have its high guard word nonzero. */
int
int edivm( den, num ) edivm (den, num)
unsigned short den[], num[]; unsigned short den[], num[];
{ {
int i; int i;
register unsigned short *p; register unsigned short *p;
unsigned long tnum; unsigned long tnum;
unsigned short j, tdenm, tquot; unsigned short j, tdenm, tquot;
unsigned short tprod[NI+1]; unsigned short tprod[NI+1];
p = &equot[0]; p = &equot[0];
*p++ = num[0]; *p++ = num[0];
*p++ = num[1]; *p++ = num[1];
for( i=M; i<NI; i++ ) for (i=M; i<NI; i++)
{ {
*p++ = 0; *p++ = 0;
} }
eshdn1( num ); eshdn1 (num);
tdenm = den[M+1]; tdenm = den[M+1];
for( i=M; i<NI; i++ ) for (i=M; i<NI; i++)
{ {
/* Find trial quotient digit (the radix is 65536). */ /* Find trial quotient digit (the radix is 65536). */
tnum = (((unsigned long) num[M]) << 16) + num[M+1]; tnum = (((unsigned long) num[M]) << 16) + num[M+1];
/* Do not execute the divide instruction if it will overflow. */ /* Do not execute the divide instruction if it will overflow. */
if( (tdenm * 0xffffL) < tnum ) if ((tdenm * 0xffffL) < tnum)
tquot = 0xffff; tquot = 0xffff;
else else
tquot = tnum / tdenm; tquot = tnum / tdenm;
/* Multiply denominator by trial quotient digit. */ /* Multiply denominator by trial quotient digit. */
m16m( tquot, den, tprod ); m16m (tquot, den, tprod);
/* The quotient digit may have been overestimated. */ /* The quotient digit may have been overestimated. */
if( ecmpm( tprod, num ) > 0 ) if (ecmpm (tprod, num) > 0)
{
tquot -= 1;
esubm( den, tprod );
if( ecmpm( tprod, num ) > 0 )
{
tquot -= 1;
esubm( den, tprod );
}
}
esubm( tprod, num );
equot[i] = tquot;
eshup6(num);
}
/* test for nonzero remainder after roundoff bit */
p = &num[M];
j = 0;
for( i=M; i<NI; i++ )
{ {
j |= *p++; tquot -= 1;
esubm (den, tprod);
if (ecmpm (tprod, num) > 0)
{
tquot -= 1;
esubm (den, tprod);
}
} }
if( j ) esubm (tprod, num);
j = 1; equot[i] = tquot;
eshup6(num);
}
/* test for nonzero remainder after roundoff bit */
p = &num[M];
j = 0;
for (i=M; i<NI; i++)
{
j |= *p++;
}
if (j)
j = 1;
for( i=0; i<NI; i++ ) for (i=0; i<NI; i++)
num[i] = equot[i]; num[i] = equot[i];
return( (int )j ); return ((int)j);
} }
/* Multiply significands */ /* Multiply significands */
int emulm( a, b ) int
unsigned short a[], b[]; emulm (a, b)
unsigned short a[], b[];
{ {
unsigned short *p, *q; unsigned short *p, *q;
unsigned short pprod[NI]; unsigned short pprod[NI];
unsigned short j; unsigned short j;
int i; int i;
equot[0] = b[0]; equot[0] = b[0];
equot[1] = b[1]; equot[1] = b[1];
for( i=M; i<NI; i++ ) for (i=M; i<NI; i++)
equot[i] = 0; equot[i] = 0;
j = 0; j = 0;
p = &a[NI-1]; p = &a[NI-1];
q = &equot[NI-1]; q = &equot[NI-1];
for( i=M+1; i<NI; i++ ) for (i=M+1; i<NI; i++)
{
if (*p == 0)
{ {
if( *p == 0 ) --p;
{ }
--p; else
} {
else m16m (*p--, b, pprod);
{ eaddm(pprod, equot);
m16m( *p--, b, pprod );
eaddm(pprod, equot);
}
j |= *q;
eshdn6(equot);
} }
j |= *q;
eshdn6(equot);
}
for( i=0; i<NI; i++ ) for (i=0; i<NI; i++)
b[i] = equot[i]; b[i] = equot[i];
/* return flag for lost nonzero bits */ /* return flag for lost nonzero bits */
return( (int)j ); return ((int)j);
} }
#endif #endif
...@@ -4476,7 +4478,7 @@ etoasc (x, string, ndigs) ...@@ -4476,7 +4478,7 @@ etoasc (x, string, ndigs)
} }
else else
{ {
*s++ = (char )digit + '0'; *s++ = (char)digit + '0';
*s++ = '.'; *s++ = '.';
} }
/* Generate digits after the decimal point. */ /* Generate digits after the decimal point. */
...@@ -5082,10 +5084,10 @@ eremain (a, b, c) ...@@ -5082,10 +5084,10 @@ eremain (a, b, c)
unsigned EMUSHORT den[NI], num[NI]; unsigned EMUSHORT den[NI], num[NI];
#ifdef NANS #ifdef NANS
if ( eisinf (b) if (eisinf (b)
|| (ecmp (a, ezero) == 0) || (ecmp (a, ezero) == 0)
|| eisnan (a) || eisnan (a)
|| eisnan (b)) || eisnan (b))
{ {
enan (c); enan (c);
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment