* __setfpucw(0x1372); (was Re: Alpha design flaw?)
[not found] ` <70o2bv$maf$1@newnews.nl.uu.net>
@ 1998-10-23 4:00 ` G. Hugh SONG
0 siblings, 0 replies; only message in thread
From: G. Hugh SONG @ 1998-10-23 4:00 UTC (permalink / raw)
Toon Moene wrote:
> kargl@troutmask.apl.washington.edu (Steven G. Kargl) wrote:
>
> > In article <362F70E2.3031@ipa.net>,
> > "Donald L. Baker" <dobak@ipa.net> writes:
>
> > > Not only does DEC Visual Fortran for Alpha
>
> > pag:kargl[258] cat a.f
> > real x,y,z
> > x = 1.e0
> > y = 0.9999999999e0
> > z = 1.e0 / (x - y)
> > print *, z
> > end
> > pag:kargl[259] f77 -fpe -o a -g2 a.f -lm
> > pag:kargl[260] dbx a
> > dbx version 3.11.8
> > Type 'help' for help.
>
> > a$main: 1 real x,y,z
> > (dbx) run
> > signal Floating point exception at [a$main:5 +0x4,0x120001894] print *, z
>
> > Perhaps, it isn't Digital's problem. Pilot error?
>
> Close. Note that Donald is talking about Digital *Visual* Fortran. Bet it
> runs on a Microsoft OS.
>
> From an earlier message:
>
> > Not only that, this kind of error now appears not in an
> > obvious window, or a jump to ntdll.dll assembly language,
> > but in the in the bottom window of DevStudio. It's as
> > if DEC thinks they can solve the problem by moving it to
> > the fine print. It's the same kind of approach that Bill
> > Clinton takes to defining sex. It may be lawyerly, but
> > it's not reliable fortran.
>
> g77 has more or less the same problem, although the real *source* of the
> problem is different: We have to support a couple of Free Unices (at the
> very least: NetBSD, Linux), Microsoft Windows NT, Digital Unix (and perhaps
> even OpenVMS, but not sure about that) - it's pretty much impossible to get
> all the `set the floating point exception mask to "trap on divide by zero"'
> right on every single OS mentioned above.
>
> --
> Toon Moene (mailto:toon@moene.indiv.nluug.nl)
> Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
> Phone: +31 346 214290; Fax: +31 346 214286
> g77 Support: mailto:fortran@gnu.org; egcs: mailto:egcs-bugs@cygnus.com
With g77 on i386 Linux, the following C routine called in the first
line of a fortran program
call FPUSETDEF
handles fpu error.
#include <fpu_control.h>
void
fpusetdef_(void)
{
__setfpucw(0x1372);
}
Isn't there any equivalent number instead of 0x1372 for
g77 on Alpha/Linux?
--
G. Hugh Song
PS: Please remove "Spamspoiler" when replying
for spam extractors, FCC Commisioners' email addresses are:
wkennard@fcc.gov,sness@fcc.gov,pmisener@fcc.gov,mpowell@fcc.gov
^ permalink raw reply [flat|nested] only message in thread