From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 20084 invoked from network); 18 Nov 1998 20:18:54 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 18 Nov 1998 20:18:54 -0000 Received: from paralleldata.com (smtp.paralleldata.com [38.153.145.2]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id PAA28344 for ; Wed, 18 Nov 1998 15:18:53 -0500 Received: by paralleldata.com from localhost (router,SLMail V2.5); Wed, 18 Nov 1998 14:20:34 -0600 Received: by paralleldata.com from paralleldata.com (207.158.98.244::mail daemon; unverified,SLMail V2.5); Wed, 18 Nov 1998 14:20:32 -0600 Sender: "Wsb" Message-ID: <36532D4F.1A8ED6F2@paralleldata.com> Date: Wed, 18 Nov 1998 20:25:51 +0000 From: "Wes Bauske" Organization: Parallel Data Systems X-Mailer: Mozilla 4.04 [en] (X11; U; Linux 2.0.33 i686) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: egcs g77 and DgncppB References: <199811181815.AA09226@tau.cc.tut.fi> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hirsim{ki Mika wrote: > > > in LIBI77 or, since it's a problem specific to that code, > > rebuild egcs with the -mieee flag active for the library > > and see if that helps. Note using -mieee does not guarantee > > FPE's go away. > > I re-compiled the libI77 with -mieee and with -mieee-with- > inexact, but neither fixed the problem. > > I've traced the problem to following part of Dgncpp code: > > real*8 sgrad,pi4 > ... > sgrad=0.16*abs(dcp(i)/pi4)/(dc(i)/pi4)**1.33 > write(28,'(5(e12.6,1x))') r(i),dc(i),sgrad,ves(i),vxc(i) > ... > > The problem is that the variable sgrad goes infinite (as > the denominator becomes zero, which is what it should do > in any case) and write chokes on it. This, of course, > is easily fixed by manually adding code that checks the > denominator before calculating sgrad, but to my mind the > compiler/runtime-libs should be able to handle a NaN. I > don't mind if it prints out NaNs, because that's basically > what the physics predicts. What I do mind is getting SIGFPEs > and a stopped execution just because write can't handle NaNs. > Depends on whether you want to get it working or try fix your programming environment. Obviously it would be nice if Alpha's supported NaN in HW in which case this wouldn't happen. There apparently was a tradeoff between being fully IEEE FP compliant and being faster and being faster won. The "-mieee" flag causes the compiler to put traps around instructions that can get FPE's that are SW correctable. The traps slow things down. Of course, having an IF() statement also slows things down but at least you control where you slow down because hopefully you know where the code can get into trouble. If it were my application, I'd check for division by zero and let it go at that. Particularly if I did not have complete control of what is in the dc() array, meaning it is filled with input data or derived from input data. Wes