home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!news2me.ebay.sun.com!exodus.Eng.Sun.COM!appserv.Eng.Sun.COM!appserv!khb
- From: khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup)
- Newsgroups: comp.lang.fortran
- Subject: Re: how to quit on an NaN result?
- Date: 16 Aug 92 14:31:41
- Organization: Sun MegaSystems
- Lines: 37
- Message-ID: <KHB.92Aug16143141@chiba.Eng.Sun.COM>
- References: <1992Aug16.200837.14024@samba.oit.unc.edu>
- NNTP-Posting-Host: chiba
- In-reply-to: Bruce.Scott@bbs.oit.unc.edu's message of 16 Aug 92 20:08:37 GMT
-
-
- > if (avar .eq. 'NaN') stop
-
- You don't mention your environment. Clearly it isn't incorporated in
- the ANSI X3.9-1978 nor the ISO 1539:1991 standards.
-
- If you are running on a Sun, using the SunPro compiler, the "obvious"
- choices are
-
- f77 $your_favorite_options -fnonstd *.f
-
- The fnonstd changing the way underflow works and trapping rather than
- ignoring "ieee exceptions". Since I personally want proper underflow,
- I'd go with
-
- i=ieee_handler("set","common",%val(2))
-
- where %val(2) is the magic number for causing SIGFPE_ABORT to occur.
-
- Or, you can test individual numbers via the
-
- int isnan(x)
-
- function from libm. This provides the most control, but requires the
- most work.
-
- See the Numerical Computation Guide for more details about these
- approaches. In addition the FORTRAN User's Guide and the various man
- pages can be helpful.
-
- If you are coding in another environment, milage may vary.
- --
- ----------------------------------------------------------------
- Keith H. Bierman keith.bierman@Sun.COM| khb@chiba.Eng.Sun.COM
- SunPro 2550 Garcia MTV 12-33 | (415 336 2648) fax 964 0946
- Mountain View, CA 94043 <speaking for myself, not Sun*> Copyright 1992
-
-