Sun FPU question
Keith Bierman Sun Tactical Engineering
khb at fatcity.Sun.COM
Tue Mar 7 11:42:27 AEST 1989
In article <331 at kvasir.esosun.UUCP> ethan at esosun.UUCP (Ethan Brown) writes:
>
>In article <10660 at pasteur.Berkeley.EDU> faustus at 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 at dogwood.Berkeley.EDU (Wayne A. Christopher)
> Newsgroups: comp.lang.c
> Date: 3 Mar 89 22:58:15 GMT
> Sender: news at 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
More information about the Comp.lang.c
mailing list