format with G descriptor
- From: Roman <shekht@xxxxxxxxxx>
- Date: Fri, 30 May 2008 11:15:05 -0700 (PDT)
Hi,
The following short program does not produce the expected
output when reading in an integer with a G descriptor.
The last write statement outputs 1.e-7 instead of 1.
Is this a compiler bug, or (most likely) I'm misunderstanding
the use of the G descriptor?
Roman
!-------------------------------------------
program test_format_G
implicit none
character(len=10) s
real r
2 format(g)
s = "1.0"
read(s,*) r
write(*,*) r ! output: 1.000000
read(s,2) r
write(*,*) r ! output: 1.000000
s = "1"
read(s,*) r
write(*,*) r ! output: 1.000000
read(s,2) r
write(*,*) r ! output: 1.0000000E-07 !!!!!!!
stop
end program test_format_G
!-------------------------------------------
.
- Follow-Ups:
- Re: format with G descriptor
- From: Kurt Kallblad
- Re: format with G descriptor
- From: James Giles
- Re: format with G descriptor
- Prev by Date: Re: Is this legal?
- Next by Date: Re: one-liner for characater replacement
- Previous by thread: Problem with file writing
- Next by thread: Re: format with G descriptor
- Index(es):
Relevant Pages
|
|