From: "Wes Bauske" <wsb@paralleldata.com>
To: axp-list@redhat.com
Subject: Re: egcs g77 and DgncppB
Date: Wed, 18 Nov 1998 20:25:51 +0000 [thread overview]
Message-ID: <36532D4F.1A8ED6F2@paralleldata.com> (raw)
In-Reply-To: 199811181815.AA09226@tau.cc.tut.fi
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
next prev parent reply other threads:[~1998-11-18 20:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-17 20:27 egcs g77 and DgncppB Greg Lindahl
1998-11-17 21:50 ` Wes Bauske
1998-11-18 18:15 ` Hirsim{ki Mika
1998-11-18 20:25 ` Wes Bauske [this message]
-- strict thread matches above, loose matches on Subject: below --
1998-11-17 22:00 Greg Lindahl
1998-11-17 22:38 ` Wes Bauske
1998-11-17 17:25 Greg Lindahl
1998-11-17 18:19 ` Wes Bauske
1998-11-15 9:55 Hirsim{ki Mika
1998-11-16 17:22 ` Greg Lindahl
1998-11-16 23:07 ` Wes Bauske
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox