Mail Archives: djgpp/1995/04/28/14:23:33
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
- Raw text -