(j3.2006) Signaling NaN
Bill Long
longb
Fri Mar 11 13:44:35 EST 2011
On 3/11/11 11:45 AM, Tobias Burnus wrote:
> On 03/11/2011 06:19 PM, Bill Long wrote:
>> The standard does specify some of this, and other parts are "processor
>> dependent".
>
> Well, I think it specifies the general format: A NaN is printed. And as
> one can deduce from the input format, a signalling NaN, if printed as
> such, has the format "NaN(" + some non-zero-sized string + ")". (Though,
> the reverse does not work: If there are alphanumeric letters between the
> "()", it can still be a quiet NaN.)
>
>> Note that the standard (inconsistently) requires that on INPUT, the
>> text is expected to be "NAN"
>
> No, it does not: "A lower-case letter is equivalent to the corresponding
> upper-case letter in an IEEE exceptional specification or the exponent
> in a numeric input field."
Quite right. I'll have our output form fixed. (I'd also suggest that
the input form in the standard be written as "NaN", which is equally
valid as "NAN", but less confusing.
I would add that the IEEE standard (754-2008) has several paragraphs in
5.12.1 that spell out conversion of NaN values to and from character
string representations. The Fortran rules seem to be consistent with
the IEEE rules.
Cheers,
Bill
>
>> and on output it is "NaN". We print NAN on output so is consistent
>> with input expectations.
>
> While we (gfortran) print "NaN". (Ignoring the issue that gfortran still
> lacks an implementation of the TR 15580/Fortran 2008 IEEE modules.)
>
> Tobias
> _______________________________________________
> 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./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101
More information about the J3
mailing list