ecleaz(y); /* start with a zero */
p = y; /* point to our number */
r = *d; /* get DEC exponent word */ if( *d & (unsignedint )0x8000 )
*p = 0xffff; /* fill in our sign */
++p; /* bump pointer to our exponent word */
r &= 0x7fff; /* strip the sign bit */ if( r == 0 ) /* answer = 0 if high order DEC word = 0 */ goto done;
r >>= 7; /* shift exponent word down 7 bits */
r += EXONE - 0201; /* subtract DEC exponent offset */ /* add our e type exponent offset */
*p++ = r; /* to form our exponent */
r = *d++; /* now do the high order mantissa */
r &= 0177; /* strip off the DEC exponent and sign bits */
r |= 0200; /* the DEC understood high order mantissa bit */
*p++ = r; /* put result in our high guard word */
*p++ = *d++; /* fill in the rest of our mantissa */
*p++ = *d++;
*p = *d;
eshdn8(y); /* shift our mantissa down 8 bits */
done:
emovo( y, e );
}
/* ;convertetypetoDECdoubleprecision ;doubled; ;shorte[NE]; ;etodec(e,&d);
*/ #if0 staticunsignedshort decbit[NI] = {0,0,0,0,0,0,0200,0}; void etodec( x, d ) unsignedshort *x, *d;
{ unsignedshort xi[NI]; registerunsignedshort r; int i, j;
emovi( x, xi );
*d = 0; if( xi[0] != 0 )
*d = 0100000;
r = xi[E]; if( r < (EXONE - 128) ) goto zout;
i = xi[M+4]; if( (i & 0200) != 0 )
{ if( (i & 0377) == 0200 )
{ if( (i & 0400) != 0 )
{ /* check all less significant bits */ for( j=M+5; j<NI; j++ )
{ if( xi[j] != 0 ) goto yesrnd;
}
} goto nornd;
}
yesrnd:
eaddm( decbit, xi );
r -= enormlz(xi);
}
nornd:
r -= EXONE;
r += 0201; if( r < 0 )
{
zout:
*d++ = 0;
*d++ = 0;
*d++ = 0;
*d++ = 0; return;
} if( r >= 0377 )
{
*d++ = 077777;
*d++ = -1;
*d++ = -1;
*d++ = -1; return;
}
r &= 0377;
r <<= 7;
eshup8( xi );
xi[M] &= 0177;
r |= xi[M];
*d++ |= r;
*d++ = xi[M+1];
*d++ = xi[M+2];
*d++ = xi[M+3];
} #else
externint rndprc;
void etodec( x, d ) unsignedshort *x, *d;
{ unsignedshort xi[NI]; long exp; int rndsav;
emovi( x, xi );
exp = (long )xi[E] - (EXONE - 0201); /* adjust exponent for offsets */ /* round off to nearest or even */
rndsav = rndprc;
rndprc = 56;
emdnorm( xi, 0, 0, exp, 64 );
rndprc = rndsav;
todec( xi, d );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.