PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Output of very small numbers with e, en format is goofed up

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



Joined: 06 Aug 2004
Posts: 2

PostPosted: Fri Sep 02, 2005 3:12 pm    Post subject: Output of very small numbers with e, en format is goofed up Reply with quote

Folks,

The following code (compiled with either pgf90 or pgf77)
shows the problem I've encountered:

Code:
     
      real*8 wow
      wow = 1d-120
      write(*,*) wow
      write(*,900) wow
  900 format(1x,e15.7)
      end


The output is
Quote:

1.0000000000000007E-120
0.1000000-119


Note that the format using 'e15.7' (the second number output) is missing the 'E'. This creates problems for me, and I don't think it's the correct behaviour. Am I out to lunch?
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Sep 02, 2005 4:42 pm    Post subject: Reply with quote

Hi Tuna,

The E edit descriptor by default is limited to 3 digits plus a sign (4 characters in total). This limit causes the truncation of exponent field and the removal of the 'E' when the exponent reaches 100. To have the 'E' printed, you need to use the second form of the E descriptor, 'Ew.dEe' where you specify the number of exponent digits to print. Changing your format to 'e15.7e3' will allow enough room for the 'E' to print.

- Mat
Back to top
View user's profile
Tuna



Joined: 06 Aug 2004
Posts: 2

PostPosted: Tue Sep 06, 2005 12:04 pm    Post subject: Reply with quote

Thanks much, that did the trick. I have not come upon the this form of the e format descriptor, but this seems to work with g, e, and en. My fortran 90 book has only listing of the 2nd e as a possiblility, but no description as to what it actually does.

This fixes the code for me. Thanks again
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