(j3.2006) Leading zeroes in D or E format when scale factor k < 0
Lionel, Steve
steve.lionel
Wed Mar 6 13:53:30 EST 2013
Consider:
write (*,'(-1PE11.5)') .25
Are either or both of the following outputs permitted by the standard?
b.02500E+01
0.02500E+01
Where b is a blank.
The standard says, F2008 p253 paragraph 4:
13 4 For an internal value that is neither an IEEE infinity nor a NaN, the form of the output field for a scale factor
14 of zero is
15 [ ? ] [0].x1x2 . . . xdexp
I assume that the appearance of [0] means that the leading 0 is optional in this form - there are no words about this in the bulleted list that follows. However, this text restricts itself to the case of a scale factor of zero.
Paragraph 6 discusses what the digits to the right of the decimal symbol should be when k is less than zero, but is silent on what is to be to the left of the decimal symbol. For consistency, I'd expect a leading zero to be optional as it is in the case of a zero scale factor.
I have looked for interpretations and previous discussions of this topic and did not find anything. This part of the standard appears unchanged since at least Fortran 90. Would it be reasonable to add some words here? I would propose changing:
If -d < k <= 0, the output field contains exactly |k| leading zeroes and d - |k| significant digits to the right of the decimal symbol.
to
If -d < k < = 0, the output field contains an optional leading zero to the left of the decimal symbol, exactly |k| leading zeroes and d - |k| significant digits to the right of the decimal symbol.
(I'm a bit uncertain about punctuation in this sentence - I'm sure Malcolm can structure it properly.)
Comments? Is this appropriate for an interpretation request?
Steve Lionel
Intel Developer Support
Merrimack, NH
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20130306/7913f9de/attachment.html
More information about the J3
mailing list