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

Malcolm Cohen malcolm
Mon Oct 19 20:47:49 EDT 2009


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.

Cheers,
-- 
................................Malcolm Cohen, Nihon NAG, Tokyo.
 




More information about the J3 mailing list