[Bug libfortran/48511] Implement Steele-White algorithm for numeric output

thenlich at users dot sourceforge.net gcc-bugzilla@gcc.gnu.org
Sun Apr 10 10:20:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48511

--- Comment #5 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-04-10 10:19:47 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > Does any of the Fortran edit descriptors require, or for that matter allow,
> > this kind of "shortest decimal representation" output?
> 
> Well, the obvious(?) answer is the various descriptors with 0 width.

Not quite:

Since we're not talking about the shortest width (w) but the smallest number of
decimal digits in the fraction (d), only those descriptors where we can select
"a processor-dependent reasonable value for d" can be "shortened":

That would be list-directed and G0 (but not G0.d).

For all others the algorithm is still useful if we append zeros to fill the
required width: it is better to print 0.3000000 than 0.2999996

I'm still not sure where the Fortran standard says "a processor-dependent
reasonable value for d" that includes a "processor-dependent reasonable value
for d which also depends on the internal value to be printed" because that
would mess up tabular aligment for printing. This might be a feature users rely
on.



More information about the Gcc-bugs mailing list