(j3.2006) Public Comment J32037

Jim Giles JamesGiles-2
Tue Jul 15 18:15:53 EDT 2008


Aleksandar Donev wrote:
...
>> Commenter's Subject was "The g0 edit descriptor"  <snip>
>> 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.
> I don't get this at all. If it is list-directed, the beauty is that
> the compiler decides the precision based on the item. [...]

There's no beauty in that if the compiler picks the wrong precision
(as they all do - and they can't change for reasons of "backward
compatibility" with their existing users - even if there was a
precision which would satisfy all their users).  In any case, that
"beauty" will still exist for Alex if he leaves off the d part of
*his* g0 edit descriptor.  The comment in no way implied that 
a d part should be a required part of a g0 edit descriptor, just 
that it should be allowed.

> [...]          If the programmer has  to think about it then the he/she
> already has 1001 different formats  with full control of precisions
> etc. [...]

None of which have variable widths.  The existing G format will
sometimes not output an exponent part, or a sign, but the user still 
has to have room for them or it won't work.  Users have to use internal 
I/O  followed by ADJUSTL and TRIM, followed finally by writing 
to the file.  Bletch. That's what I have to do now - that's what I was 
hoping not to have to do with g0 - but, that's what I'll still have to do 
under the current proposal.

> [...]          The point of g0 was "the compiler
> shall do the right thing", notably, it is assumed the QofI will
> ensure that:
>> an input item will have the
>> same internal value as the original value that was
>> output

No implementation I've ever used did that for list-directed.  Why
would they start doing it for G format?  It would be inconsistent with
the precision they've chosen for list-directed, for one thing.  And there
isn't only one defintion of "the right thing" anyway.

Assume that WO is whatever operation Writes Out the data and that
RI is whatever operation Reads In the data.  Most numerically savvy
programmers want the following as an identity they can rely on:

1) RI(WO(X)) == X

Most naive programmers want the following as an identity they
can rely on:

2) WO(RI(D)) == D

Where D is a decimal number they see on a listing or on the screen.
Well for IEEE single, condition (1) requires that the output use 9
decimal digits, while for condition (2) the output should use 6 decimal
digits.  Most implementations choose to output 7 decimal digits for
list-directed, which satisfies neither group of users.  That being the
case, both sets of users will avoid g0: the savvy users for the same
reason they already avoid list-directed, and the naive users because
list-directed is still easier even though it gives them the same "wrong"
answers.

J. Giles



More information about the J3 mailing list