This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fix - testcase] Formatted output of IEEE exceptional values - regression


One clarification:

Brooks Moses wrote, quoting from the F2003 standard:
For an internal value that is an IEEE infinity, the output field consists of blanks, if necessary, followed by a minus sign for negative infinity or an optional plus sign otherwise, followed by the letters 'Inf' or 'Infinity', right justified within the field. If w is less than 3, the field is filled with asterisks; otherwise, if w is less than 8, 'Inf' is produced.


On rereading this, I realized that this seems to state that if w is less than 8 but not less than 3, "Inf" is required to be produced. Further, the minus sign is required.

This might appear to be a contradiction in the case of w=3 and a negative infinity.

(That apparent contradiction is, I think, the reason people have been erroneously interpreting that the w=3 negative-infinity case should produce "Inf".)

However, it isn't a contradiction, albeit one has to have very fine hair-splitting ability to see it. Note that the phrase is "'Inf' is produced", not "the field contains 'Inf'". And section 10.6.1 of the F2003 standard makes it clear that these phrases are not the same thing. To quote:

--------
On output, if the number of characters produced exceeds the field width or if an exponent exceeds its specified length using the Ew.d Ee, ENw.d Ee, ESw.d Ee, or Gw.d Ee edit descriptor, the processor shall fill the entire field of width w with asterisks.
--------


So. The "characters produced" consist of "-Inf" in the case of w=3. This is four characters, which is greater than three; thus, the output field is required to be "***".


On a related note, the standard does _not_ say that "Infinity" is produced if w is 8 or greater. It appears that the author of the test case in question misunderstood this point.


- Brooks


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]