www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/28/14:23:33

Date: Fri, 28 Apr 1995 04:37:12 -0300 (ADT)
From: Bill Davidson <bdavidson AT ra DOT isisnet DOT com>
Subject: Re: Trapping floating point exceptions
To: Tilmann Haeberle <til AT zentrum DOT phys DOT chemie DOT tu-muenchen DOT de>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019