(j3.2006) out_of_range and sNaN

Bill Long longb
Thu Oct 6 08:45:21 EDT 2016


On Oct 5, 2016, at 7:08 PM, Robert Corbett <robert.corbett at oracle.com> wrote:

> On 10/5/2016 5:43 AM, Bill Long wrote:
>> On Oct 4, 2016, at 11:39 PM, Cohen Malcolm <malcolm at nag-j.co.jp> wrote:
>> 
>>> I agree with Bill that the result is already well-specified.
>>> 
>>> It is certainly not obvious from the current text whether SNaN raises
>>> INVALID.  Given that one of the intended (by 60559) uses of SNaN is for
>>> uninitialized variable representation, there is certainly a case for it
>>> raising INVALID here.
>> On the other hand, the (obvious, efficient) execution of the function would not involve any operation that would trigger INVALID in hardware. So, if we want to require this, there would be a performance hit forcing implementations to either explicitly check for the value and manually force the signal, or perform some waste operation, like X + 0.0, to trigger the signal.  I doubt that anyone would do this unless we specifically say that this extra work is required by the standard.  In terms of checking for an  uninitialized value, I would anticipate there would be other uses of X in nearby code that would trigger INVALID anyway.
> 
> What obvious efficient implementation do you have in mind?
> How do you propose testing for X being a NaN?

Examining the exponent bits using a mask. Same way the IEEE_* module routines do,   I think you can get both Infinity and NaN with a single, simple test, so especially appealing for OUT_OF_RANGE where Infinity and NaN are treated the same 

Cheers,
Bill

> 
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.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./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list