(j3.2006) J3/09-292 - J3 Fortran interp letter ballot#19 - due19-Oct-2009

Van Snyder Van.Snyder
Mon Oct 19 20:56:12 EDT 2009


On Mon, 2009-10-19 at 17:47 -0700, Malcolm Cohen wrote:
> Bill Long wrote:
> > I believe that HYPOT was added as part of the "lets support C's libm 
> > functions".  The added feature of HYPOT is the suppression of typical 
> > optimizations so as to avoid overflow or underflow.  I suspect few will use 
> > it, but those who do really want this behavior.
> 
> In which case they will want to avoid C hypot().
> 
> Yes, the very purpose of C hypot() is to avoid unnecessary over/underflow.  From 
> bitter experience I can attest that hypot() has not been reliable in this.  Over 
> time the number of bad ones has decreased, but I ran across another one that 
> gave a spurious overflow only a month or two ago!
> 
> So my experience is that a C programmer who requires
> (a) no spurious over/under flow calculating sqrt(a**2+b**2)
> (b) code that runs everywhere without modification or ifdef
> will have to write a safe version himself.

Now that we have C interoperability, the C programmer who requires...
could write a Fortran procedure that uses CABS and call that from C.

> Cheers,




More information about the J3 mailing list