The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Any tips for FORTRAN I/O?
07-03-2016, 06:59 PM (This post was last modified: 07-03-2016 10:32 PM by StephenG1CMZ.)
Post: #1
Any tips for FORTRAN I/O?
Many datasets still use Fortran-formatted IO files.

For those unfamaliar with Fortran, there is a heavy emphasis on data being in a fixed column on the line.

I have tried generating such output, mainly so that I can verify my input routines before letting them loose on real data.

I am finding that the built-in procedures are not giving me what I had hoped for in this context.

As an example, suppose you want a fixed-format with d digits after the decimal point - not just useful for FORTRAN files, it could also be useful in printing out log tables.

But STRING does not seem to deliver the requested number of digits.

Code:

 
 MR()
 BEGIN
  // WE CAN HAVE UP TO 12 DIGITS OF PRECISION
  STRING(0.1234567891123456789,6,12);
  //BUT MAY SEE LESS
   //HAD HOPED TO SEE DECIMAL POINT IN SAME PLACE
   //FOLLOWED BY SPACES OR ZEROS
  STRING(0.123,5,12);//SEE 0.123=NOT THE REQUESTED PRECISION
 END;
 EXPORT RD()
 BEGIN
  MR();
 END;

I had hoped for a string with 12 positions after the decimal (not accurately, but simply for laying out a formatted column of numbers). Instead STRING sometimes seems to reduce the requested precision - confusing 1.000 with 1.0, in effect.

Am I using precision correctly? Is their a better built-in I have overlooked?
Are there any useful libraries for such formatting?

Stephen Lewkowicz (G1CMZ)
https://my.numworks.com/python/steveg1cmz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Any tips for FORTRAN I/O? - StephenG1CMZ - 07-03-2016 06:59 PM



User(s) browsing this thread: 1 Guest(s)