home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / fortran / 3094 < prev    next >
Encoding:
Text File  |  1992-08-19  |  1.6 KB  |  43 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!utcsri!torn!maccs!mcshub!zooks!roy
  3. From: roy@zooks.eng.mcmaster.ca (Roy Underhill)
  4. Subject: Re: how to quit on an NaN result?
  5. Message-ID: <1992Aug19.183208.27708@mcshub.dcss.mcmaster.ca>
  6. Summary: answer with SGI
  7. Keywords: SGI,sigfpe,TRAP_FPE,NaN
  8. Sender: Roy Underhill
  9. Nntp-Posting-Host: zooks.eng.mcmaster.ca
  10. Organization: Dept. of Mech. Eng., McMaster University
  11. References: <1992Aug16.200837.14024@samba.oit.unc.edu>
  12. Date: Wed, 19 Aug 1992 18:32:08 GMT
  13. Lines: 28
  14.  
  15. >  I am debugging code which is still in the stage where many NaN results
  16.  
  17.  
  18. On a Silicon Graphics machine there are a couple of ways to do this 
  19. that have worked reliably for me.  The easiest is to set an
  20. environment variable, TRAP_FPE, to a string that will govern what
  21. action is taken.  For example
  22.  
  23. setenv TRAP_FPE "ALL=ABORT"
  24.  
  25. in the script that executes your program or by a system call within
  26. your fortran program will cause a crash and burn for any floating
  27. point exception - underflow, overflow, divide by zero or indeterminate
  28. operation.  The alternative is that one can write a custom error
  29. handler.  Mine is fairly simple; all it does it tell me what happened
  30. and then it calls abort() to force a core dump.  All the gory details are
  31. in <fsigfpe.h>.
  32.  
  33.     These are not standard and are system dependent.  BUT they do
  34. work.  So I hope that that was of help to any SGI fortran developers.
  35.  
  36.  
  37. Roy
  38. -- 
  39.    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
  40.   Roy Underhill,  (416) 525-9140 x4395   roy@zooks.eng.mcmaster.ca 
  41.   Department of Mechanical Engineering,  McMaster University, 
  42.   Hamilton,  Ontario,  Canada            L8S 4L7
  43.