Its not really necessary in the actual code I have, but just out of curiosity, why does fortran 90 read 0.1 (as in 1/10) as 0.100000001? And is there a way of making it read 0.1 as its supposed to? I tried it as 1/10 but that didn't work..
Oh, now I understand, that makes a lot of sense. I was opening and closing the file every single time in the loop, hence overwriting the data in the file on every loop iteration. I tried putting the whole open,write,close statements outside of the loop which didn't quite work either.. but...
Thanks for the help. The code inside the loop works fine. It outputs all the data into terminal fine, but only the last result gets output into the text file.
I've written a test code for illustrative purposes.
program test
implicit none
integer,parameter :: file_no=2
integer :: a
real ...
Hi,
I've got a script with a do while loop that performs a function until a given condition. It performs it about 5000 times, and produces a result on each iteration. I've managed to get fortran to output the data to a .txt file, but it only outputs the result of the last iteration, but I need...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.