From tege@noisy.tmg.se  Sun Jun  9 18:02:47 1996
Received: from noisy.tmg.se (noisy.matematik.su.se [130.237.198.146])
          by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id SAA23736
          for <FreeBSD-gnats-submit@freebsd.org>; Sun, 9 Jun 1996 18:02:45 -0700 (PDT)
Received: (from tege@localhost) by noisy.tmg.se (8.6.12/8.6.12) id DAA18966; Mon, 10 Jun 1996 03:02:05 +0200
Message-Id: <199606100102.DAA18966@noisy.tmg.se>
Date: Mon, 10 Jun 1996 03:02:05 +0200
From: Torbjorn Granlund <tege@noisy.tmg.se>
Reply-To: tege@matematik.su.se
To: FreeBSD-gnats-submit@freebsd.org
Subject: dc miscomputes remainder
X-Send-Pr-Version: 3.2

>Number:         1305
>Category:       bin
>Synopsis:       dc miscomputes remainder
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    steve
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun  9 18:10:01 PDT 1996
>Closed-Date:    Wed Nov 6 08:18:39 PST 1996
>Last-Modified:  Wed Nov  6 08:23:42 PST 1996
>Originator:     Torbjorn Granlund
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
TMG Datakonsult
>Environment:

Doesn't seem to matter (sic).  Just to make sure, I tried two radically
different machines.

>Description:

The remainder operator ('%') doesn't always work right.

>How-To-Repeat:

$ dc
20176126330 14336 %p
1012666

The correct answer is 14329.

>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: scrappy 
State-Changed-When: Tue Oct 22 20:36:11 PDT 1996 
State-Changed-Why:  


Anyone know anythhing about this code?  If not, I'll try digging into it, but 
if someone else knows a fix...? 


From: John Polstra <jdp@polstra.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc: freebsd-bugs@freebsd.org
Subject: Re: bin/1305: dc miscomputes remainder
Date: Wed, 23 Oct 1996 09:05:51 -0700

 > $ dc
 > 20176126330 14336 %p
 > 1012666
 > 
 > The correct answer is 14329.
 
 According to my HP-16 calculator, the correct answer is 12666, not
 14329.  So maybe it is a simple bug involving a portion of the answer
 not getting cleared properly.
 
 I built GNU bc-1.03, which contains their current version of "dc".  This
 problem is fixed in that version.  The code is _very_ different from
 what we have in our source tree.
 
 The best solution might be to replace our "dc" and "bc" with the current
 GNU versions.  They were released in November 1994, so they are presumably
 quite stable.  Our "bc" and "dc" are already GPL-tainted; that's not
 an issue.
State-Changed-From-To: feedback->closed 
State-Changed-By: jdp 
State-Changed-When: Wed Nov 6 08:18:39 PST 1996 
State-Changed-Why:  
Fixed by upgrading to newer version.  For reference, the upgrade 
was committed at 1996/11/04 04:23:51, and includes Makefile version 
1.5 along with many other files. 


Responsible-Changed-From-To: freebsd-bugs->steve 
Responsible-Changed-By: jdp 
Responsible-Changed-When: Wed Nov 6 08:18:39 PST 1996 
Responsible-Changed-Why:  
Steve@freebsd.org committed the new version which fixed the problem. 
>Unformatted:
