Xref: utzoo comp.lang.c:16757 comp.lang.fortran:1804 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!eecae!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c,comp.lang.fortran Subject: Re: Sun FPU question Message-ID: <16249@mimsy.UUCP> Date: 7 Mar 89 04:42:21 GMT References: <10660@pasteur.Berkeley.EDU> <331@kvasir.esosun.UUCP> <92698@sun.uucp> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 34 In article <92698@sun.uucp> khb@fatcity.Sun.COM (Keith Bierman Sun Tactical Engineering) writes: >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. I would prefer that this be the default behaviour, and that a call should be required to get standard IEEE operation. This has the advantage of producing a compile-time (or link-time) error when the program is moved to another machine which does not support IEEE arithmetic. Defaults should always be the most useful mode, but `most useful' depends on the application and the programmer, and having experienced porting problems, I am biased towards `most useful' => `least likely to surprise'. >Of course, you can get much better results by being clever and letting >nature take its course, and check in key places.... Assuming, of course, that you are willing to restrict yourself to IEEE- capable machines. This is not an unreasonable binding: F.P. arithmetic tends to be quite machine dependent, and IEEE is probably the best available compromise. But whatever you choose, it should be made clear. Simply assuming that IEEE behaviour will occur is dangerous. Commenting that it is required is better, but still leads to surprises (many people never look at the code they use, and most should never *have* to). Thus, for my own protection, I would like to have to call a function, or set a compile-time switch or similar, to get IEEE-compliant arithmetic. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris