Xref: utzoo comp.lang.c:16719 comp.lang.fortran:1799 Path: utzoo!attcan!uunet!seismo!esosun!ethan From: ethan@esosun.UUCP (Ethan Brown) Newsgroups: comp.lang.c,comp.lang.fortran Subject: Re: Sun FPU question Message-ID: <331@kvasir.esosun.UUCP> Date: 4 Mar 89 22:22:48 GMT References: <10660@pasteur.Berkeley.EDU> Organization: SAIC, San Diego Lines: 31 In-reply-to: faustus@dogwood.Berkeley.EDU's message of 3 Mar 89 22:58:15 GMT 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 way) I got some warnings about IEEE exceptions raised but not cleared. It seems that only SOME of the IEEE exceptions cause program termination. There are some manual sections explaining how to set up your own IEEE exception handler (c.f. f77_ieee_environment.3f (there is probably an equivalent entry for C)) that were very helpful. After becoming familiar with the IEEE exception handling functions you should be able to trap your divide-by-zero conditions. Hope this helps,