home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / fortran / 3052 < prev    next >
Encoding:
Internet Message Format  |  1992-08-16  |  1.7 KB

  1. 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
  2. From: khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup)
  3. Newsgroups: comp.lang.fortran
  4. Subject: Re: how to quit on an NaN result?
  5. Date: 16 Aug 92 14:31:41
  6. Organization: Sun MegaSystems
  7. Lines: 37
  8. Message-ID: <KHB.92Aug16143141@chiba.Eng.Sun.COM>
  9. References: <1992Aug16.200837.14024@samba.oit.unc.edu>
  10. NNTP-Posting-Host: chiba
  11. In-reply-to: Bruce.Scott@bbs.oit.unc.edu's message of 16 Aug 92 20:08:37 GMT
  12.  
  13.  
  14. >        if (avar .eq. 'NaN') stop
  15.  
  16. You don't mention your environment. Clearly it isn't incorporated in
  17. the ANSI X3.9-1978 nor the ISO 1539:1991 standards.
  18.  
  19. If you are running on a Sun, using the SunPro compiler, the "obvious"
  20. choices are
  21.  
  22.     f77 $your_favorite_options -fnonstd *.f
  23.  
  24. The fnonstd changing the way underflow works and trapping rather than
  25. ignoring "ieee exceptions". Since I personally want proper underflow,
  26. I'd go with
  27.  
  28.     i=ieee_handler("set","common",%val(2)) 
  29.  
  30. where %val(2) is the magic number for causing SIGFPE_ABORT to occur. 
  31.  
  32. Or, you can test individual numbers via the 
  33.  
  34.      int isnan(x)
  35.  
  36. function from libm. This provides the most control, but requires the
  37. most work.
  38.  
  39. See the Numerical Computation Guide for more details about these
  40. approaches. In addition the FORTRAN User's Guide and the various man
  41. pages can be helpful.
  42.  
  43. If you are coding in another environment, milage may vary.
  44. --
  45. ----------------------------------------------------------------
  46. Keith H. Bierman    keith.bierman@Sun.COM| khb@chiba.Eng.Sun.COM
  47. SunPro 2550 Garcia MTV 12-33             | (415 336 2648) fax 964 0946
  48. Mountain View, CA 94043  <speaking for myself, not Sun*> Copyright 1992
  49.  
  50.