Re: format with G descriptor
- From: Roman <shekht@xxxxxxxxxx>
- Date: Fri, 30 May 2008 12:48:54 -0700 (PDT)
What happens when you don't obey to the standard depends on the
compiler.
Try e.g with "g10.0" and it will work - or way not with
"read(s,*) r" if you are using Fortran 90/95 or later,
Cut from one manual:
The full descripor is: Gw.d[Ee] where
w is the field width
m is the minimum number of digits that must be in the field
(including zeros).
d is the number of digits to the right of the decimal point
E is the exponent field
e is the number of digits in the exponent
Rules for Input Processing
On input, the G data edit descriptor transfers w characters from
an external field and assigns their real value to the
corresponding I/O list item. The G descriptor interprets and
assigns input data in the same way as the F data edit descriptor.
Rules for Input Processing
On input, the F data edit descriptor transfers w characters from
an external field and assigns their real value to the
corresponding I/O list item. The external field data must be an
integer or real constant.
If the input field contains only an exponent letter or decimal
point, it is treated as a zero value.
If the input field does not contain a decimal point or an
exponent, it is treated as a real number of w digits, with d
digits to the right of the decimal point. (Leading zeros are
added, if necessary.)
If the input field contains a decimal point, the location of that
decimal point overrides the location specified by the F
descriptor.
If the field contains an exponent, that exponent is used to
establish the magnitude of the value before it is assigned to the
list element.What a compiler does if you don't follow this might
be whatever it likes!
Kurt
Thanks for the detailed reply. I make a wrong assumpsion that the
code was ok since I didn't get any errors or warning from the
compiler.
Roman
.
- Follow-Ups:
- Re: format with G descriptor
- From: glen herrmannsfeldt
- Re: format with G descriptor
- References:
- format with G descriptor
- From: Roman
- Re: format with G descriptor
- From: Kurt Kallblad
- format with G descriptor
- Prev by Date: Re: format with G descriptor
- Next by Date: Re: format with G descriptor
- Previous by thread: Re: format with G descriptor
- Next by thread: Re: format with G descriptor
- Index(es):
Relevant Pages
|
|