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