Xenix-386 + 80287 --> garbage

Richard Bassett fredb at cheops.EECS.UNSW.OZ
Mon Apr 25 02:38:49 AEST 1988


/***
		Attn davidsen at kbsvax.steinmetz.ge.com (and others):

Ye who do not believe .....
TRY THIS (assuming no other floating pt activity):
	cc this_stuff
	a.out &			# run 1 in background
	sleep a_while		# enjoy the silence
	a.out			# make it 2 (or more)
	# Now await fun error messages
	# Also check what happens during hard disc activity
	# Remove the 287 and try again

OUR HARDWARE:
	NEC Powermate-386	16MHz 386, 4Mb memory
	80287-10	<--- was 80287-8 before
O/S:
	Xenix-386 SysV rel 2.2.1
------------ cut here ------------------ ***/
 double
dabs( x )
  double x;
  {
  return ( x >= 0.0 ? x : -x );
  }

main()
  {
  int stat;
  long pid;
  long i;
  double x, y;
  double inc, inc_on1000;
  char buf[ 256 ];

  pid = getpid();
  inc = 0.0001;
  inc_on1000 = inc / 1000.0;

	/* infinite loop: */
	/* increment integer, avoids roundoff if repeating f.p addition */
	/* let i overflow (if you wait that long) */
  for (x = y = 0.0, i = 0L;		; ++i )
    {
    stat = 1;
    x = i * inc;
	/* convert x to ASCII and back again: */
    sprintf(buf,"%22.14e", x);
    if ( sscanf(buf,"%lf", &y) != 1)
	{
	printf("sscanf != 1");
	stat = 0;
	}
	/* test if approx same: */
    if ( dabs( y - x ) > inc_on1000)
	{
	printf("Conversion");
	stat = 0;
	}
    if (!stat)
	{
	printf(" ERROR in pid %ld:\n", pid);
	printf("buf \"%s\",x=%22.14e,y=%22.14e\n", buf, x, y);
	}
    }
  }
/***
R J Bassett, Dept of Textile Tech, Uni of NSW,
PO Box 1, Kensington, NSW 2033, AUSTRALIA	: Ph. +61 2 697 4454
-- 
ACSnet:	fredb at cheops.unsw.oz
ARPA:	fredb at cheops.unsw.oz.au
UUCP:	{uunet,mcvax}!cheops.unsw.oz!fredb
***/



More information about the Comp.unix.xenix mailing list