Open Beliavsky opened 2 years ago
Possibly a better way to write the same statement:
When dividing two integer numbers, you will get a truncated integer, not a real number, so 1/2 is 0 (gfortran will warn about this with -Wall, but for constants only).
If what you really want is the real number, write real(i,wp)/j , i/real(j,wp), ...
Given integer variables i and j write
real(i,wp)/j
ori/real(j,wp)
orreal(i,wp)/real(j,wp)
where
wp
is the KIND argument to get areal(kind=wp)
quotient, unless you want the truncating integer division resulting fromi/j
In Fortran 1/2 = 0.