Article View: comp.sys.acorn.tech
Article #841Suppressing floating point errors in C
From: Paul Moore
Date: Wed, 06 Jan 1993 21:16
Date: Wed, 06 Jan 1993 21:16
35 lines
1161 bytes
1161 bytes
The following code, when compiled, generates a stack backtrace,
and the program exits with status zero. How do I get the program
to continue to the "return 0"? (Note: I KNOW ignoring FP errors
is not good in the general case - in this case, and in the "real"
case where this is a problem for me, the naff value in d is never
used, and so is harmless.)
-------- Cut here --------
#include <signal.h>
/* Dummy - see below */
void a (double d)
{
}
int main (void)
{
double d;
signal (SIGFPE, SIG_IGN);
d = 1.0;
d /= 0.0;
/* To ensure that the compiler does not
* optimise away the floating point operation
*/
a (d);
return 0;
}
-------- Cut Here --------
Thanks in advance for any help.
Gustav.
Technical Details
Message-ID:
<memo.845760@cix.compulink.co.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!cix.compulink.co.uk!pmooreShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!pipex!demon!cix.compulink.co.uk!pmoore Newsgroups: comp.sys.acorn.tech From: pmoore@cix.compulink.co.uk (Paul Moore) Subject: Suppressing floating point errors in C Reply-To: pmoore@cix.compulink.co.uk Date: Wed, 6 Jan 1993 21:16:00 +0000 Message-ID: <memo.845760@cix.compulink.co.uk> Sender: usenet@demon.co.uk Lines: 35