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

LVL 1
travisjbennettAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
travisjbennettAuthor Commented:
Wow! Perfect. It turns out I had only tested the ...kPE... format on the second E but not the first. Thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.