Date: Fri, 28 Apr 1995 04:37:12 -0300 (ADT) From: Bill Davidson Subject: Re: Trapping floating point exceptions To: Tilmann Haeberle Cc: djgpp AT sun DOT soe DOT clarkson DOT edu On Thu, 27 Apr 1995, Tilmann Haeberle wrote: > How do I handle > (a) division by zero > (b) 0/0 invalid operation > (c) sqrt(negative) > (d) log(negative) ... > with floating point numbers gracefully > in my programs? Actually, gcc in it's default state handles a lot of this very gracefully, even outputting 'Inf' or 'NaN' when you try to printf() these sorts of results. For a good demo, and the ability to modify the FP control word, look for a package called 'ctrl87.zip'; I think it might be on Clarkson's ftp site, and at S. Turnbull's site (if you don't have his address, just wait a day and it will appear on this list! :-) If you _really_ can't find it, let me know and I'll mail it to you. Bill Davidson bdavidson AT ra DOT isisnet DOT com