Re: COBOL, IEEE Std 754-2008 Signaling NaN
On Sun, 10 Apr 2011 19:46:47 -0600 Keith Bierman wrote:
The only exception is IBM that prints NaNQ
and NaNS (which does not conform to Standard Fortran).
Standard Fortran says that (case insensitive) NAN and NAN()
are quiet NaNs, while everything else is processor dependent.
Clearly this IS Standard compliant because it's Processor Dependent!
Here is what the Fortran standard says:
J3/03-007R2 Final Committee Draft OCT 2003
10.6.1.2 Real and complex editing
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.
10.6.1.2.1 F editing
An input field that is an IEEE exceptional specification consists of
optional blanks, followed by either of
(2) an optional sign, followed by the string 'NAN', optionally
followed by zero or more alphanumeric characters enclosed in
[3.1 defines alphanumeric character as: letter, digit or underscore]
The value specified by form (2) is an IEEE NaN; this form shall not be
used if the processor does not support IEEE NaNs for the input
variable. The NaN value is a quiet NaN if the only nonblank characters
in the field are 'NAN' or 'NAN()'; otherwise, the NaN value is
processor-dependent. The interpretation of a sign in a NaN input field
is processor dependent.
For an internal value that is an IEEE NaN, the output field consists
of blanks, if necessary, followed by the letters 'NaN' and optionally
followed by one to w - 5 alphanumeric processor-dependent characters
enclosed in parentheses, right justified within the field. If w is
less than 3, the field is filled with asterisks.
The processor-dependent characters following 'NaN' may convey
additional information about that particular NaN.
So, NaN(Q) and NaN(S) are valid, while NaNQ and NaNS are invalid.
Fred J. Tydeman Tydeman Consulting
tydeman@xxxxxxxxx Testing, numerics, programming
+1 (775) 358-9748 Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.