catching FPEs?

Colin Kelley colin at vu-vlsi.UUCP
Thu Oct 2 02:40:09 AEST 1986


I'm using 4.2bsd on a Pyramid.  I'm working on a plotting program which
allows users to plot arbitrary functions.  Sometimes these functions will
blow up for one reason or another (usually because their argument is out
of range), giving a Floating Point Exception, followed by a core dump.  I
already trap obvious things like division by zero in my own code, setting a
flag to mark the current data point as undefined (so it is not plotted).  Now
I want to trap FPEs using signal(), having my FPE handler routine set the same
flag, then continue.  Unfortunately, it seems that when my handler routine
returns, the same FPE is occurring again, causing an infinite loop...

Is there some way to trap FPEs and then indicate that you want to resume
execution _after_ the code which caused the FPE?  (setjmp()/longjmp() won't
work too well here because I don't just want to return to one place--I want
to continue execution wherever it left off.)  Or is there a way to modify the
argument which was passed into that code so that it will be able to continue
without another FPE?

Thanks...

			-Colin Kelley ..{cbmvax,pyrnj,psuvax1}!vu-vlsi!colin



More information about the Comp.unix mailing list