🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #5430

bug in GCC floating point lib

#5430
From: Piet van Oostrum
Date: Mon, 30 Oct 1989 16:06
48 lines
1881 bytes
I discovered a bug in the double precision floating point lib by Scott
McCauley/John Dunning (dflonum.c). The routine to convert doubles to
floating had a long where an unsigned long was required, thus causing a
right shift to do a sign extend. This gives a few bit errors in some
conversions. There was also a superfluous satement. Here is a patch:

*** dflonum.c.~1~	Thu Jul 13 12:27:25 1989
--- dflonum.c	Fri Oct 27 09:52:42 1989
***************
*** 636,642 ****
  double f;
  {
  	struct bitdouble *bdp;
! 	int si, ex, mant1, mant2;
  	bdp = &f;
  	si = bdp->sign;
  	ex = bdp->exp;
--- 636,643 ----
  double f;
  {
  	struct bitdouble *bdp;
! 	int si, ex;
! 	unsigned long mant1, mant2;
  	bdp = &f;
  	si = bdp->sign;
  	ex = bdp->exp;
***************
*** 644,650 ****
  	mant2 = bdp->mant2;
  
  	/* zero value */
! 	if (ex == 0) return(0L);
  	/* less than 1 */
  	if (ex < 0x3ff) return(0L);
  	/* less than 0 */
--- 645,651 ----
  	mant2 = bdp->mant2;
  
  	/* zero value */
! /*	if (ex == 0) return(0L); */ /* this is covered in next line */
  	/* less than 1 */
  	if (ex < 0x3ff) return(0L);
  	/* less than 0 */
-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht,  The Netherlands.
Telephone: +31-30-531806      Internet: piet@cs.ruu.nl
Telefax:   +31-30-513791      Uucp: uunet!mcsun!hp4nl!ruuinf!piet
Technical Details
Message-ID: <1749@ruuinf.cs.ruu.nl>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!piet

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!piet
From: piet@cs.ruu.nl (Piet van Oostrum)
Newsgroups: comp.sys.atari.st
Subject: bug in GCC floating point lib
Message-ID: <1749@ruuinf.cs.ruu.nl>
Date: 30 Oct 89 16:06:44 GMT
Sender: news@ruuinf.cs.ruu.nl
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Organization: Dept of Computer Science, University of Utrecht, Holland
Lines: 48