🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.msdos.programmer
2 messages
2 total messages Started by RAMontante Fri, 03 Aug 1990 15:26
Re: Turbo C matherr() function
#1774
Author: RAMontante
Date: Fri, 03 Aug 1990 15:26
15 lines
1205 bytes
As Pete Holzmann says, matherr() only catches math errors in library
functions.  You must use the SIG_FPE/setjmp/longjmp facilities to
handle "lower-level" math errors.

I found that it was really hard to recover from a general math error ---
what do you want to do on divide-by-zero, for example?  Generate a
largest-possible-value? print a message? ... The simplest thing to do
is to simply clear everything out and longjmp back to some point in
your code that precedes the failed operation (and your error-handler
doesn't necessarily know where that is).

Plug:  I am told that my rpn calculator is queued for c.b.i.p.  It includes
source code, and I use both the matherr() and the SIG_FPE code to handle
math errors.  I don't claim it's the best example of such stuff, but it
*is* a working example...
Re: Turbo C matherr() function
#1832
Author: Bernie Roehl
Date: Wed, 08 Aug 1990 19:18
11 lines
841 bytes
Thanks for all the answers about matherr()... the bottom line seems to be that
I'll have to trap the errors using SIG_FPE instead of just writing my own
math handler.

Sigh.

-- 
	Bernie Roehl, University of Waterloo Electrical Engineering Dept
	Mail: broehl@watserv1.waterloo.edu OR broehl@watserv1.UWaterloo.ca
	BangPath: {allegra,decvax,utzoo,clyde}!watmath!watserv1!broehl
	Voice:  (519) 885-1211 x 2607 [work]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads