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

Bill Long longb
Mon Oct 19 17:36:51 EDT 2009



Van Snyder wrote:
> On Mon, 2009-10-19 at 08:29 -0700, Bill Long wrote:
>> Added Comment for F03/0039:
>>
>> There is no HYPOT intrinsic function in Fortran 2003. It is a Fortran 
>> 2008 feature. I think this interp is out of order.  Suggestions for 
>> changes to HYPOT should be in the form of a J3 paper of a FCD ballot 
>> comment.
>>
>> [I retain my NO vote, and suggest the interp should be rejected.]
> 
> I would go a step further and advocate that HYPOT is unnecessary and
> ought to be removed from the draft, given that it is the same as CABS or
> NORM2.
> 
> In place of HYPOT(A,B) one can write either
>   ABS(CMPLX(A,B))

ABS(CMPLX(A,B,kind(A)))

> or
>   NORM2([A,B])
> 
> Admittedly, both formally require the construction of a temp, but clever
> optimizers, especially ones that inline CABS, ought to be able to get
> rid of it.
> 
> We don't have many intrinsic functions as trivial as HYPOT, and we
> haven't introduced any other than HYPOT in 2008.


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.

Cheers,
Bill



> 
>> Cheers,
>> Bill
>>
>>
>>
>>
>> Bill Long wrote:
>>> -----------------------------------
>>> Comments:
>>>
>>>
>>> F03/0039:
>>> ---------
>>>
>>> The text in the IEEE 754-2008 standard says (bottom of page 43):
>>>
>>> "For the hypot function, hypot(?0, ?0) is +0, hypot(??, qNaN) is +?,
>>> and hypot(qNaN, ??) is +?. "
>>>
>>> If the argument for changing the rules for IEEE_LOGB() in Interp
>>> F03/0034 is to make the Fortran rules match the IEEE rules, then the
>>> same argument would seem to apply here.  Yet the changes I see
>>> proposed do not result in HYPOT returning the IEEE-required results
>>> when one of the arguments is a NaN and the other is an Infinity.
>>>
>>> If we really want the results to be NaN, then the interp should
>>> clearly state that the values we require contradict the IEEE rules.
>>>
> 
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120





More information about the J3 mailing list