From: mariano mendez on

> subroutine c
>    character(len=10), parameter :: fmt = '(ES12.4)'
>    real :: x = 42, y = 1066
>    write(*, fmt) x
>    write(*, fmt) y
> end subroutine c
>

Steve this is exactly what I mean! intead of having :

subroutine b
real :: x = 42, y = 1066
write(*, 10) x
write(*, 10) y
10 format (ES12.4)
end subroutine b

Mariano
From: mariano mendez on

> I have to admit that I never used Eclipse before. Do you have any useful
> suggestion guide/howto/book for Eclipse and Photran?
>
> --
> Lurkos

Lurkos: Please feel free to contact me for any question about Eclipse
or Photran.

Regards

Mariano
From: David W Noon on
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 11 Jul 2010 09:25:36 -0700 (PDT), steve wrote about Re: IDE for
ifort on Linux:

[snip]
>I believe that you may have misread what Mariano wrote. I don't
>see much difference in the following code:
>
>program a
> call b
> call c
>end program a
>
>subroutine b
> real :: x = 42, y = 1066
> write(*, 10) x
> write(*, 10) y
>10 format (ES12.4)
>end subroutine b
>
>subroutine c
> character(len=10), parameter :: fmt = '(ES12.4)'
> real :: x = 42, y = 1066
> write(*, fmt) x
> write(*, fmt) y
>end subroutine c

Aha. So what does this buy me?
- --
Regards,

Dave [RLU #314465]
=======================================================================
dwnoon(a)spamtrap.ntlworld.com (David W Noon)
Remove spam trap to reply by e-mail.
=======================================================================
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)

iEYEARECAAYFAkw6OgMACgkQ9MqaUJQw2Mk3/ACfU6C7tB0kx+0ctJ/IxuL+NRBT
YV0An2wyGqfcRenxAPy9W/ZDg8q69nGY
=Ex7h
-----END PGP SIGNATURE-----
From: steve on
On Jul 11, 2:39 pm, David W Noon <dwn...(a)spamtrap.ntlworld.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Sun, 11 Jul 2010 09:25:36 -0700 (PDT), steve wrote about Re: IDE for
> ifort on Linux:
>
> [snip]
>
>
>
> >I believe that you may have misread what Mariano wrote.  I don't
> >see much difference in the following code:
>
> >program a
> >   call b
> >   call c
> >end program a
>
> >subroutine b
> >   real :: x = 42, y = 1066
> >   write(*, 10) x
> >   write(*, 10) y
> >10 format (ES12.4)
> >end subroutine b
>
> >subroutine c
> >   character(len=10), parameter :: fmt = '(ES12.4)'
> >   real :: x = 42, y = 1066
> >   write(*, fmt) x
> >   write(*, fmt) y
> >end subroutine c
>
> Aha.  So what does this buy me?
> - --

See Dan Nagle's reply.

module formats
implicit none
character(len=10), parameter :: &
& fmt_f = '(ES14.6)' & ! 7 digits
& fmt_d = '(ES22.13)' ! 14 digits.
end module formats

Now, use this module everywhere in your project. If
you find out that double precision actually has 15 digits
of precision, then you only need to change one line of
code for the entire project.

--
steve
From: Louis Krupp on
On 7/11/2010 4:29 PM, steve wrote:
> On Jul 11, 2:39 pm, David W Noon<dwn...(a)spamtrap.ntlworld.com> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On Sun, 11 Jul 2010 09:25:36 -0700 (PDT), steve wrote about Re: IDE for
>> ifort on Linux:
>>
>> [snip]
>>
>>
>>
>>> I believe that you may have misread what Mariano wrote. I don't
>>> see much difference in the following code:
>>
>>> program a
>>> call b
>>> call c
>>> end program a
>>
>>> subroutine b
>>> real :: x = 42, y = 1066
>>> write(*, 10) x
>>> write(*, 10) y
>>> 10 format (ES12.4)
>>> end subroutine b
>>
>>> subroutine c
>>> character(len=10), parameter :: fmt = '(ES12.4)'
>>> real :: x = 42, y = 1066
>>> write(*, fmt) x
>>> write(*, fmt) y
>>> end subroutine c
>>
>> Aha. So what does this buy me?
>> - --
>
> See Dan Nagle's reply.
>
> module formats
> implicit none
> character(len=10), parameter ::&
> & fmt_f = '(ES14.6)'& ! 7 digits
> & fmt_d = '(ES22.13)' ! 14 digits.
> end module formats
>
> Now, use this module everywhere in your project. If
> you find out that double precision actually has 15 digits
> of precision, then you only need to change one line of
> code for the entire project.

Stupid question:

Can you remove the '(len=10)'? Having to count the characters in the
string seems like a Bad Thing, inviting unfavorable comparison with C
(where you can do things like 'const char *fmt = "(f12.6)") and bringing
back unpleasant memories of Hollerith format strings...

Louis