*BSD News Article 96475


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!news.maxwell.syr.edu!pumpkin.pangea.ca!news.mira.net.au!news.netspace.net.au!news.mel.connect.com.au!news.syd.connect.com.au!news.bri.connect.com.au!corolla.OntheNet.com.au!not-for-mail
From: Tony Griffiths <tonyg@OntheNet.com.au>
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: FreeBSD 221 math problem, help
Date: Fri, 30 May 1997 15:05:36 +1000
Organization: On the Net (ISP on the Gold Coast, Australia)
Lines: 29
Message-ID: <338E6020.5045@OntheNet.com.au>
References: <01bc6afa$0dd23720$3976c9ce@amuancw110>
Reply-To: tonyg@OntheNet.com.au
NNTP-Posting-Host: swanee.nt.com.au
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.0 (WinNT; I)
To: Tim Brown <Tim.Brown@ctg.com>
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:41852

Tim Brown wrote:
> 
> I am getting a math error (FPE) in some pretty old code.  The code works
> basically everywhere but freebsd 221.  It even seems to work on older
> freebsd systems.
> 
> The code is:
> 
> -216 + 5 -1316 *40 / (40 * -.00012120)
> 
> I have broken it down like so to narrow it down:
> 
> double x = -217 +5 -1316 *40;
> double y= 40 * -.00012120;
> double a = x/y;
> 
> I ran this and when I got the FPE while in gdb, y was 0.  Why??
> It seems that "y" was rounded off to 0.  All other OS's I have run this on
> (AIX, SunOS, older freeBSD, others) do not have this problem.  Is there a
> magical gcc command line option I need to use?

You're not using a Pentium with the FP bug by any chance?

Is there a program on the net for testing if you have a "dud" Pentium? 
The problem was in multiplication (I think)!

If so please post a pointer...

Tony