- #1
aaron2
- 5
- 0
EDIT: Sorry, forgot to mention 'FORTRAN' in the subject line...
Hi, I'm new to fortran but I'm trying to generate the first 1476 terms of the fibonacci sequence, then examine the first digit of each term and store the number of 1s, 2s, 3s, ..., 9s that occur into an array. I have it to where it prints all of the terms to a text file, and I was going to try to read the first number from each new line.
However, it has been several hours and I have not been able to use this method, so I've decided to just get the first digit of the real number before actually writing it to the text document. Then, it's just a matter of reading the text document line by line without having to deal with all of the formatting business.
So, my question boils down to extracting the first digit of a double precision number (real*8) and storing it into an integer. Any ideas of how to do this?
Hi, I'm new to fortran but I'm trying to generate the first 1476 terms of the fibonacci sequence, then examine the first digit of each term and store the number of 1s, 2s, 3s, ..., 9s that occur into an array. I have it to where it prints all of the terms to a text file, and I was going to try to read the first number from each new line.
However, it has been several hours and I have not been able to use this method, so I've decided to just get the first digit of the real number before actually writing it to the text document. Then, it's just a matter of reading the text document line by line without having to deal with all of the formatting business.
So, my question boils down to extracting the first digit of a double precision number (real*8) and storing it into an integer. Any ideas of how to do this?