Received: (from major@localhost)
	by minnie.cs.adfa.oz.au (8.8.5/8.8.5) id HAA00762
	for pups-liszt; Tue, 7 Apr 1998 07:25:32 +1000 (EST)
X-Authentication-Warning: minnie.cs.adfa.oz.au: major set sender to owner-pups@minnie.cs.adfa.oz.au using -f
Received: from mail13.digital.com (mail13.digital.com [192.208.46.30])
	by minnie.cs.adfa.oz.au (8.8.5/8.8.5) with ESMTP id HAA00757
	for <pups@minnie.cs.adfa.oz.au>; Tue, 7 Apr 1998 07:25:25 +1000 (EST)
Received: from cst.ako.dec.com (cst.ako.dec.com [16.151.72.40])
	by mail13.digital.com (8.8.8/8.8.8/WV1.0d) with ESMTP id RAA17311
	for <pups@minnie.cs.adfa.oz.au>; Mon, 6 Apr 1998 17:25:19 -0400 (EDT)
Received: by cst.ako.dec.com with Internet Mail Service (5.0.1458.49)
	id <HSD5TL25>; Mon, 6 Apr 1998 17:26:02 -0400
Message-ID: <6B84B1FF221BD011B0AC08002BE69206683E78@excmso.mso.dec.com>
From: Bob Supnik <Bob.Supnik@digital.com>
To: pups@minnie.cs.adfa.oz.au
Subject: RE: Bug in Bob Supnik's Emulator?
Date: Mon, 6 Apr 1998 17:25:57 -0400 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1458.49)
Content-Type: text/plain
Sender: owner-pups@minnie.cs.adfa.oz.au
Precedence: bulk

There is indeed a bug in the floating point emulator: MODf was setting
the condition codes off the integer result, not the fractional result.

To fix the bug, look for this code fragment in source module pdp11_fp.c

case 3:							/* MODf */
	ReadFP (&fsrc, GeteaFP (dstspec, lenf), dstspec, lenf);
	F_LOAD (qdouble, FR[ac], fac);
	newV = modfp11 (&fac, &fsrc, &modfrac);
	F_STORE (qdouble, fac, FR[ac | 1]);
	F_STORE (qdouble, modfrac, FR[ac]);
==>	FPS = setfcc (FPS, fac.h, newV);
	break;

Change the indicated code line to be:

==>	FPS = setfcc (FPS, modfrac.h, newV);

and recompile.

Thanks to Warren Toomey for getting me the source to FACTOR, which
showed the bug.

(I can't believe this is the problem with vi, but who knows?  A bug in
MODf could affect the binary to decimal conversion routines in the run
time libraries.)

