Link to home
Start Free TrialLog in
Avatar of travisjbennett
travisjbennettFlag for United States of America

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of travisjbennett

ASKER

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