LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What does it mean in GFortran. Question II? (https://www.linuxquestions.org/questions/linux-newbie-8/what-does-it-mean-in-gfortran-question-ii-4175528500/)

AlexBB 12-16-2014 08:23 PM

What does it mean in GFortran. Question II?
 
I found this expression I do not understand:

Code:

fac(nf+2) = real ( ntry, kind = 8 )
I understand, there is an array on the left, but why is there a declaration on the right. ntry is declared previously as integer*4 and now it is kind=8, why?

Should it be understood as: assign ntry to fact(nf+2) element but first convert ntry to real*8? Why don't people then write the code simpler:

Code:

fact(nf+2) = DBLE(ntry)
Thanks, - A.

suicidaleggroll 12-16-2014 08:26 PM

Quote:

Originally Posted by AlexBB (Post 5285871)
Should it be understood as: assign ntry to fact(nf+2) element but first convert ntry to real*8?

Yes

Quote:

Originally Posted by AlexBB (Post 5285871)
Why don't people then write the code simpler:

Code:

fact(nf+2) = DBLE(ntry)

Could have to do with portability, or perhaps DBLE() isn't ANSI in whatever version of Fortran this is?

AlexBB 12-17-2014 07:25 PM

One more down, many more to go. Suicidaleggroll, thank you again.


All times are GMT -5. The time now is 04:25 AM.