I want to initialize an array of large integers in fortran, I have tried:
integer(kind=8) :: XGrid(1:20)
But the integers remain the default kind=4. As I later add numbers to the array:
XGrid = (/3002, 3340403,....,19460630000/)
And I receive a "This numeric constant is out of range" error. As it wont fit in a kind=4 int, but will in a kind=8 int.
I have also tried declaring it as:
integer, parameter :: ik8 = selected_int_kind(8)
integer(ik8) :: XGrid(1:20)
But this also did not work.
Edit: Thanks Vladimir F, but I am trying to define an array rather than just a single variable and as such I cant understand how to adapt the answer used in: Is There a Better Double-Precision Assignment in Fortran 90? Would it be:
integer, parameter :: ik8 = selected_int_kind(8)
integer(ik8) :: XGrid(1:20)_ik8
XGrid = (/3002_ik8, 3340403_ik8,....,19460630000_ik8/)
or is it different? Thanks