Xref: utzoo comp.lang.c:16753 comp.lang.fortran:1803 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!bloom-beacon!apple!oliveb!sun!fatcity!khb From: khb@fatcity.Sun.COM (Keith Bierman Sun Tactical Engineering) Newsgroups: comp.lang.c,comp.lang.fortran Subject: Re: Sun FPU question Message-ID: <92698@sun.uucp> Date: 7 Mar 89 01:42:27 GMT References: <10660@pasteur.Berkeley.EDU> <331@kvasir.esosun.UUCP> Sender: news@sun.uucp Reply-To: khb@sun.UUCP (Keith Bierman Sun Tactical Engineering) Organization: Sun Microsystems, Mountain View Lines: 45 In article <331@kvasir.esosun.UUCP> ethan@esosun.UUCP (Ethan Brown) writes: > >In article <10660@pasteur.Berkeley.EDU> faustus@dogwood.Berkeley.EDU (Wayne A. Christopher) writes: > > Path: esosun!seismo!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!dogwood.Berkeley.EDU!faustus > From: faustus@dogwood.Berkeley.EDU (Wayne A. Christopher) > Newsgroups: comp.lang.c > Date: 3 Mar 89 22:58:15 GMT > Sender: news@pasteur.Berkeley.EDU > Lines: 6 > > It seems that on some Suns, the FPU by default doesn't signal > divide-by-zero errors, but makes the result Inf or NaN. Is there a way > to make it give a floating point error? Does gcc have a flag for > this? How about the MIPS compiler, which has the same behavior? > > Wayne > >Wayne: > I found similar problems on a Sun 4 when testing a FORTRAN program I'm >currently working on. After the program terminated (normally, by the... I suspect that dgh will post something (or has, the net acts as a time warp of sorts) the fact of the matter is that this is what SHOULD happen. IEEE arithmetic sez so. To get the behavior you desire (if you have SunOS 4.+), add the following line of code to your main program. i = ieee_handler("set","common",SIGFPE_ABORT) Now your sun will act like a pre-ieee machine, and dump core when anything nasty happens. Of course, you can get much better results by being clever and letting nature take its course, and check in key places.... Cheers. khb Keith H. Bierman It's Not My Fault ---- I Voted for Bill & Opus