Home > Archive > Fortran > January 2006 > Is this a Fortran 2003 feature
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 |
Is this a Fortran 2003 feature
|
|
| Herman D. Knoble 2006-01-20, 7:09 pm |
| What Fortran Standards support edit descripters fw.d
where w=0; in particular f0.0; for example:
real :: value
value=100.0
write(*,'(1x,f0.0)') value
end
What is the rule in such cases?
Thanks.
Skip Knoble
| |
| Michael Metcalf 2006-01-20, 7:09 pm |
|
"Herman D. Knoble" <SkipKnobleLESS@SPAMpsu.DOT.edu> wrote in message
news:0602t1tt4q8894erdii3nesbd0jlsf8p2e@
4ax.com...
> What Fortran Standards support edit descripters fw.d
> where w=0; in particular f0.0; for example:
>
> real :: value
> value=100.0
> write(*,'(1x,f0.0)') value
> end
>
This is Fortran 95. See MR&C Section 9.12.3.
Regards,
Mike Metcalf
| |
| Dan Nagle 2006-01-20, 7:09 pm |
| Hello,
Herman D. Knoble wrote:
> What Fortran Standards support edit descripters fw.d
> where w=0; in particular f0.0; for example:
>
> real :: value
> value=100.0
> write(*,'(1x,f0.0)') value
> end
>
> What is the rule in such cases?
>
> Thanks.
> Skip Knoble
Read 10.6.1.2.1 F Editing on page 228, at lines 9 and 10
in 04-007.pdf
HTH
--
Cheers!
Dan Nagle
Purple Sage Computing Solutions, Inc.
| |
| Brooks Moses 2006-01-22, 3:57 am |
| Herman D. Knoble wrote:
> What Fortran Standards support edit descripters fw.d
> where w=0; in particular f0.0; for example:
>
> real :: value
> value=100.0
> write(*,'(1x,f0.0)') value
> end
>
> What is the rule in such cases?
This is a Fortran 95 feature, as others have noted. In this particular
case, d=0 has its usual meaning -- that there are no digits after the
decimal point -- and w=0 means "the processor chooses the field width".
- Brooks
--
The "bmoses-nospam" address is valid; no unmunging needed.
| |
| Richard Maine 2006-01-22, 3:57 am |
| Brooks Moses <bmoses-nospam@cits1.stanford.edu> wrote:
>
> This is a Fortran 95 feature, as others have noted. In this particular
> case, d=0 has its usual meaning -- that there are no digits after the
> decimal point -- and w=0 means "the processor chooses the field width".
Well... I'd quibble with that description of what the w=0 means. The
processor doesn't get a choice. It must use the smallest field width in
which the value will fit.
(Well, I didn't go to the trouble to look up the exact words right now,
but that's sure the way I recall it.)
The processor gets to choose for list-directed and namelist.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
| |
| Steven G. Kargl 2006-01-22, 3:57 am |
| In article <1h9jejd.e85amit4d2xdN%nospam@see.signature>,
nospam@see.signature (Richard Maine) writes:
> Brooks Moses <bmoses-nospam@cits1.stanford.edu> wrote:
>
>
> Well... I'd quibble with that description of what the w=0 means. The
> processor doesn't get a choice. It must use the smallest field width in
> which the value will fit.
10.5.1 (6)
On output, with I, B, O, Z, and F editing, the specified value of the
field width w may be zero. In such cases, the processor selects the
smallest positive actual field width that does not result in a field
filled with asterisks. The specified value of w shall not be zero
on input.
10.5.1.2.1 F editing
The Fw.d edit descriptor indicates that the field occupies w positions,
the fractional part of which consists of d digits. When w is zero, the
processor selects the field width. On input, w shall not be zero.
It is interesting that 10.5.1.2.1 is missing the word "smallest".
Does the "general rule" of 10.5.1 (6) trump the specific rule of
10.5.1.2.1?
--
Steve
http://troutmask.apl.washington.edu/~kargl/
| |
| Richard Maine 2006-01-22, 9:59 pm |
| Steven G. Kargl <kargl@troutmask.apl.washington.edu> wrote:
> 10.5.1 (6)
> On output, with I, B, O, Z, and F editing, the specified value of the
> field width w may be zero. In such cases, the processor selects the
> smallest positive actual field width that does not result in a field
> filled with asterisks. The specified value of w shall not be zero
> on input.
>
> 10.5.1.2.1 F editing
> The Fw.d edit descriptor indicates that the field occupies w positions,
> the fractional part of which consists of d digits. When w is zero, the
> processor selects the field width. On input, w shall not be zero.
>
> It is interesting that 10.5.1.2.1 is missing the word "smallest".
> Does the "general rule" of 10.5.1 (6) trump the specific rule of
> 10.5.1.2.1?
Probably not the world's best way of writing of it, but I think I'd read
it as that the processor selects the field width in accordance with
10.5.1(6), which doesn't actually leave the processor any choice in the
selection.
My apologies to Brooks for quibbling with "his" description, which seems
to be pretty much the description used in the standard. I still think it
a bit misleading description. Arguably technically correct, but
misleading. But the "fault" lies in the standard's words.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
| |
| Brooks Moses 2006-01-22, 9:59 pm |
| Richard Maine wrote:
> Steven G. Kargl <kargl@troutmask.apl.washington.edu> wrote:
>
> Probably not the world's best way of writing of it, but I think I'd read
> it as that the processor selects the field width in accordance with
> 10.5.1(6), which doesn't actually leave the processor any choice in the
> selection.
>
> My apologies to Brooks for quibbling with "his" description, which seems
> to be pretty much the description used in the standard. I still think it
> a bit misleading description. Arguably technically correct, but
> misleading. But the "fault" lies in the standard's words.
Apology certainly accepted. The quibble was certainly appropriate at
least in spirit, as I had missed paragraph 10.5.1(6) completely, and so
what I did quote was definitely misleading -- I know it was misleading,
because I was misled by it myself.
- Brooks
--
The "bmoses-nospam" address is valid; no unmunging needed.
| |
| John Harper 2006-01-23, 9:56 pm |
| In article <43D3F863.50203@cits1.stanford.edu>,
Brooks Moses <bmoses-nospam@cits1.stanford.edu> wrote:[color=darkred]
>Richard Maine wrote:
True, but there was a discussion here of this very point about a month
ago. Compiler-writers disagree on what they think the standard requires
for F0.d output of a value between 0 and 1, e.g. 0.5. Some put in the
leading zero so F0.1 prints (or writes) 0.5, and others leave it out,
so F0.1 prints .5. Some changed their minds recently when I pointed
out what Richard just did: F2.1 prints .5 not **, F1.1 prints *, so
F0.1 must print .5, by 10.5.1(6). Gfortran didn't need fixing, g95 was
debugged late last year, but you may have to wait for the next release
of other compilers that need this bug removed.
--
John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington, New Zealand
e-mail john.harper@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045
|
|
|
|
|