From: James Giles on
The g0 edit descriptor

According to the draft document:

C1007 (R1006) For the G edit descriptor, d shall be
specified if and only if w is not zero.

To me this eliminates any value the g0 feature might
have. What's needed is something like list-directed
output but with the precision controlled by the
programmer.

For example, in order for an input item to have the
same internal value as the original value that was
output, the output must generally carry at least 9
digits (for IEEE single precision).

If the ability to specify d were present, G would
probably become my main output edit descriptor. I was
looking forward to g0 before I found that it wasn't
allowed a d part.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare

"Simplicity is prerequisite for reliability" -- E. W. Dijkstra


From: Ron Shepard on
In article
<HIEbk.95950$102.47046(a)bgtnsc05-news.ops.worldnet.att.net>,
"James Giles" <jamesgiles(a)worldnet.att.net> wrote:

> What's needed is something like list-directed
> output but with the precision controlled by the
> programmer.

This has been discussed here before, but IMO there are two output
format specifiers that are "needed" in fortran that are not, and
have not ever been, available. One is the one that you give above,
which results in the minimum width field that prints a specified
number of decimal digits. The other "needed" format is the one that
prints in a specified fixed-width field, and results in the maximum
number of significant digits in that field (perhaps with enough
flexibility also to eliminate optional "+" signs and "e" exponent
characters). It is possible to use internal writes to character
variables that mimic both types of formats, but this introduces
additional complications into the whole formatted I/O process.
These abilities should have been added to the language long ago.

$.02 -Ron Shepard <--IMO, of course
From: Colin Watters on

"Ron Shepard" <ron-shepard(a)NOSPAM.comcast.net> wrote in message
news:ron-shepard-6E37CA.06423106072008(a)comcast.dca.giganews.com...
> In article
> <HIEbk.95950$102.47046(a)bgtnsc05-news.ops.worldnet.att.net>,
> "James Giles" <jamesgiles(a)worldnet.att.net> wrote:
>
>> What's needed is something like list-directed
>> output but with the precision controlled by the
>> programmer.
>
> This has been discussed here before, but IMO there are two output
> format specifiers that are "needed" in fortran that are not, and
> have not ever been, available. One is the one that you give above,
> which results in the minimum width field that prints a specified
> number of decimal digits. The other "needed" format is the one that
> prints in a specified fixed-width field, and results in the maximum
> number of significant digits in that field (perhaps with enough
> flexibility also to eliminate optional "+" signs and "e" exponent
> characters). It is possible to use internal writes to character
> variables that mimic both types of formats, but this introduces
> additional complications into the whole formatted I/O process.
> These abilities should have been added to the language long ago.
>
> $.02 -Ron Shepard <--IMO, of course

Hear, hear!

--
Qolin

Email: my qname at domain dot com
Domain: qomputing


From: Clive Page on
>> This has been discussed here before, but IMO there are two output
>> format specifiers that are "needed" in fortran that are not, and
>> have not ever been, available. One is the one that you give above,
>> which results in the minimum width field that prints a specified
>> number of decimal digits. The other "needed" format is the one that
>> prints in a specified fixed-width field, and results in the maximum
>> number of significant digits in that field (perhaps with enough
>> flexibility also to eliminate optional "+" signs and "e" exponent
>> characters). It is possible to use internal writes to character
>> variables that mimic both types of formats, but this introduces
>> additional complications into the whole formatted I/O process.
>> These abilities should have been added to the language long ago.
>>
>> $.02 -Ron Shepard <--IMO, of course

I have needed those too (and have spent hours coding them via internal
file writes), so totally agree. I guess they would need a new format
edit descriptor to be defined. Of course D, E, F, and G are used. But
H doesn't seem to be used very much any more... :-)


--
Clive Page
From: James Giles on
Clive Page wrote:
>>> This has been discussed here before, but IMO there are two output
>>> format specifiers that are "needed" in fortran that are not, and
>>> have not ever been, available. One is the one that you give above,
>>> which results in the minimum width field that prints a specified
>>> number of decimal digits. The other "needed" format is the one that
>>> prints in a specified fixed-width field, and results in the maximum
>>> number of significant digits in that field (perhaps with enough
>>> flexibility also to eliminate optional "+" signs and "e" exponent
>>> characters). It is possible to use internal writes to character
>>> variables that mimic both types of formats, but this introduces
>>> additional complications into the whole formatted I/O process.
>>> These abilities should have been added to the language long ago.
....
> I have needed those too (and have spent hours coding them via internal
> file writes), so totally agree. I guess they would need a new format
> edit descriptor to be defined. Of course D, E, F, and G are used. But H
> doesn't seem to be used very much any more... :-)

Why not just G? If the format specifier is G0.9, that means output
nine decimal digits of precision, using an exponent part only if it's
necessary, and fitting the whole in as little width as possible. If the
specifier is G9 (no d part), that means print as many digits as possible
in 9 spaces, again using an exponent part only if necessary.

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare

"Simplicity is prerequisite for reliability" -- E. W. Dijkstra