There is a equation in Fortran 95 to calculate some position for an array, I copied and pasted the same equation in Python, but they return different results.
EDIT: on the rush for an answer, I forgot to show the declarations of the variables, but they are in the Fortran code example now. And it turns out the declaration was the problem, thanks to @SurestTexas and @albert for pointing it out in the comments, and everyone else who helped.
The equation in Fortran:
integer(2) :: i, j
integer(4) :: e, n_x
n_x = 1162
j = ((-2.8 - (-8.4)) / 0.05) + 1
i = ((-4.5 - (-5.1)) / 0.05) + 1
e = ((i-1)*n_x+j)
I print e
, which results in: 12894
And in Python:
n_x = 1162
j = ((-2.8 - (-8.4)) / 0.05) + 1
i = ((-4.5 - (-5.1)) / 0.05) + 1
e = ((i-1)*n_x+j)
I print e
, which results in: 14057.0
As you can see, they are exactly the same, I can't find out what is wrong and how I can solve the issue, please help me.