Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

sum on array longer than max value

$
0
0

Hi all,

I just discover than the sum intrinsic function use the type of the array ( I guess) to do the sum and therefor if the array is longer than the max value of type. I don't know if that is defined in the standard, is there a solution to this other than custom sum function ?

program sum1
integer(1),dimension(200) :: int1
integer(2),dimension(200000) :: int2

int1=1
int2=1
print *,sum(int1)
print *,sum(int2)
end program

 

Gives the results  -56   3392.

Thanks for your thoughts on this.

P.

 


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>