For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > Re: Format statement problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Format statement problem
David Flower

2005-05-13, 4:10 pm

Try D16.8. (I dislike G format, but that's a personal opinion)

The 8 is the number of digits after the decimal point, and the 16 is
the total length output. You need 8 extra spaces:
Possible lead minus sign
0
Richard E Maine

2005-05-13, 4:10 pm

In article <1115912400.992619.8840@g49g2000cwa.googlegroups.com>,
"David Flower" <DavJFlower@AOL.COM> wrote:

> Try D16.8.

.....
> D
> + or -
> Three digit exponent


If you have found a compiler that gives output like this from a D16.8
format, then you should submit a bug report to the vendor for violating
the Fortran standard.

Yes, the field width of 16 would allow enough room for this, but you
need to do more than just check whether there is enough room. The
standard specifies what goes into that field. In particular, you
will *NOT* get both the exponent letter and a 3-digit exponent (which
was exactly the question being asked); if you get that, the compiler is
broken.

See other replies for how to write a format specifier that will achieve
this effect (namely e16.8e3 or variants thereof, the e3 on the end being
the critical part).

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain | experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com