catching FPEs?

Rick Perry perry at vu-vlsi.UUCP
Thu Oct 2 13:31:14 AEST 1986


In article <371 at vu-vlsi.UUCP> colin at vu-vlsi.UUCP (Colin Kelley) writes:
>I'm using 4.2bsd on a Pyramid...
>...
>Is there some way to trap FPEs and then indicate that you want to resume
>execution _after_ the code which caused the FPE?

You didn't mention that your program is written in C, but I guess that's
the default in the Real World.  If it was Fartran, you could simply do:

	call trpfpe( inmax(), dflmax() )

thereby specifying that Floating Point Execptions are to be replaced
by dflmax() (largest double float on the machine) for up to inmax()
(largest integer on the machine) occurances.  These things are available
on Pyramid from f77, don't know about other machines, but perhaps there
is an easy way to call that from C on Pyramid ? 

When you do that, the FPE's are trapped and fixed, and msg like:

on_fpe: floating point exception (or overflow or something...)

or something like that is printed on stdout or stderr, not sure which...

...Rick			..somewhere!here!f77!vu-vlsi!perry



More information about the Comp.unix mailing list