From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,753e8a1dde5c68a2 X-Google-Attributes: gid111c93,public From: Joerg Schmalzl Subject: Re: Floating point exceptions Date: 1999/09/23 Message-ID: <37EA1915.3F54@earth.uni-muenster.de>#1/1 X-Deja-AN: 528612015 Content-Transfer-Encoding: 7bit Sender: "Joerg Schmalzl" References: Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@uni-muenster.de X-Trace: redenix.uni-muenster.de 938088726 16236 128.176.216.227 (23 Sep 1999 12:12:06 GMT) Organization: University Muenster, Geophysical Inst. Mime-Version: 1.0 NNTP-Posting-Date: 23 Sep 1999 12:12:06 GMT Newsgroups: comp.os.linux.alpha Konrad Hinsen wrote: > > I am trying to install some numerical code on an Alpha system running > RedHat 6.0, and I get lots of crashes. It seems that the math library > generates a floating point exception in many cases (e.g. log(-1.)) > where I'd rather like to get an error code back to my routines. > Is there any way to change this? > -- Sure ... install a signal handler: in the main prog call (void) signal(SIGFPE, error_handler); where you can define the error handler yourself e.g. error_handler(err_sig) int err_sig; { /** do something here **/ } You have to include signal.h of course .. Cheers, Joerg -- ------------------------------------------------------------ Dr. Joerg Schmalzl, Institute of Geophysics, Muenster University , Corrensstr. 24, D-48149 Muenster, Germany, phone, office: (++49) 251 8334703, priv.: (++49) 251 784820, fax: (++49) 251 8336100, e-mail: joergs@earth.uni-muenster.de ------------------------------------------------------------