CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   question on fortran (https://www.cfd-online.com/Forums/main/6158-question-fortran.html)

tim May 23, 2003 17:46

question on fortran
 
hi, everybody:

I am working on writing a converter between 2 commercial software. i.e., i must parse the output of one software to the input of another software.

software A's output has 5 significant digits. software B's input data field width has only 7 characters.

if i use "F7.4" format to output, i lose record that >9999. if i use "E7.2", I only have 2 signicicant digits.

Is there a way to do the converting job while preserve as many significant digits as possible. one way is to use nested if statements and select the right format statements accordingly.

Any one knows a better method than this stupid one?

Thanks to all!

Tim

hall May 24, 2003 16:27

Re: question on fortran
 
commercial software only has 7 characters? that's bad. Maybe you can try 'g' instead of 'e' and 'f'

BeachComber May 27, 2003 08:38

Re: question on fortran
 
Actually, your nested loop is not so stupid - it is a good way, with relatively simple logic and coding, to optimize the output for given ranges of numbers. I'd say go with it.


All times are GMT -4. The time now is 00:22.