PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Printing format control

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Ignacio Fdez. Galvan



Joined: 22 Aug 2013
Posts: 10

PostPosted: Tue Sep 03, 2013 7:38 am    Post subject: Printing format control Reply with quote

In this FORTRAN 77 program:

Code:
      program test
      write(6,*) '- - - - - - - - - - - - - - - - - - - - - - - - - - ',
     &           '- - - - - - - - - - - - - - - - - - - - - - - - - -'
      write(6,'(2G15.5)') 0.1,0.0
      end


I get the following output with pgf77:

Code:
 - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - - - - - - - - - - - - - - - - - - - -
    0.10000        0.00000E+00


I would like all the hyphens in a single line, and the zero printed as "0.00000" (or "0.0000"). I know I can do that by modifying the source, but that is quite cumbersome with a long program.

Can I add some flag or option to the compiler to get the desired output?
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6213
Location: The Portland Group Inc.

PostPosted: Tue Sep 03, 2013 1:36 pm    Post subject: Reply with quote

Hi Ignacio Fdez. Galvan,

With list-directed output, different compiler implementations may break up lines. You must use formatted output to force the desired behavior:
Code:
      write(6,9) '---- ...
     &         '---- ...
     9 format(a,a)


Per the F77 Specification, 'E' must be used to get "0.0". The F90 Specification changed the behavior of 'G'. You may wish to compile this code using "pgf90" or "pgfortran".

Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group