Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 77 output bugs

  1. Nov 13, 2009 #1
    I recently inherited some legacy code written in fortran77 which I'm going to be modifying quite a bit, and at this stage I find that I'm continually getting stuck on small fortran quirks... Just wondering if I could get some advice on this particular problem.

    I'm outputting the values of several arrays one element at a time since I'm already looping over all the elements for other reasons:

    Code (Text):
    write(5,101) x(j),z(i),dp(i,j)
    101 format(2e15.5,1e15.5)

    I get some nice columns as expected in my ascii file:
    Code (Text):

    .10790E+03   .92222E+02  .53132E-02
    .10790E+03   .94909E+02  .12401E-12
    .10790E+03   .97909E+02  .43214E-50
    The problem is that the third column occasionally has values that have 3-digit negative exponents and for some reason the E is being left out. So instead of .23414E-200, i'm getting .223414-200. I've tried increasing the number of characters and the number of significant digits in the format statement but no matter what I do, it doesn't print the E for any negative exponent with more than two digits.
    Anyone know:
    1) Why this is happening?
    2) How to get it to print the E?

    Also, I recognize that these are SMALL numbers, and they probably reflect some other problem in the code somewhere. So when I figure that out, I probably won't have to worry about this problem, but it's bugging me that I can't get the E to print with the numbers as is...
  2. jcsd
  3. Nov 14, 2009 #2
  4. Nov 16, 2009 #3
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook