gfortran compiler Error: result of exponentiation exceeds the range of INTEGER(4)
The problem arises as one part of your computation is done using integer arithmetic of type integer(4)
.
That type has an upper limit of 2^31-1 = 2147483647
whereas your intermediate result 5^15 = 30517578125
is slightly larger (thanks to @evets comment).
As pointed out in your question: you save the result in a real variable.
Therefor, you could just compute that exponentiation using real
data types: 5.0**15
.
Your formula will end up like the following
dFeV(x)= R1 * (5.0**15) * (a**2) * exp(-(VmigFe)/kbt)
Note that integer(4)
need not be the same implementation for every processor (thanks @IanBush).
Which just means that for some specific machines the upper limit might be different from 2^31-1 = 2147483647
.