• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 296
  • Last Modified:

Fortran (G95) Formatting: Scaling Factor kP for Expon. Notation

In Fortran 95, I am trying to use the scaling factor kP as described in http://search.cpan.org/~itub/Fortran-Format-0.90/Format.pm

I am using Fortran 95 with G95. I have pasted a snippet of my code below. I just need to know how to modify the format string to make it so it prints, for example, 1.7278612E+20 and not 0.1727861E+21
I always want the first significant digit to be the only digit before the decimal.

No, I'm not using Matlab, but there is no Fortran group.
DO J=1,iENERGIES,1
         WRITE(UNIT=2,FMT='(3(E15.7,1X),A,E12.5,A)',IOSTAT=IOSTAT)
     &   (CMcmV(I,J,K),K=1,iANGLES),
     &   "  for E =",ENERGY_TAB(J),"[J]"
        ENDDO

Open in new window

0
travisjbennett
Asked:
travisjbennett
1 Solution
 
Saqib Husain, SyedEngineerCommented:
Checkout this modification highlighted by ^'s

Saqib
WRITE(UNIT=2,FMT='(3(1PE15.7,1X),A,1PE12.5,A)',IOSTAT=IOSTAT)
                     ^^            ^^

Open in new window

0
 
travisjbennettAuthor Commented:
Wow! Perfect. It turns out I had only tested the ...kPE... format on the second E but not the first. Thanks!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now