On Mon, 7 Feb 2011, Berend Hasselman <b...@xs4all.nl> wrote:
The overflow is not caused by 16 bits integers. I'm quite sure the OP is using 32 bit integers. The overflow is caused by the multiplication N*(i-1) and/or i*(i+1).
In Fortran there's not much you can do about this unless your compiler supports larger integers.
Most modern Fortran compilers offer larger integers. The selected_int_kind() function can be used to find the appropriate integer KIND for your compiler. Most, like gfortran, use kind=8 for long integer
integer (kind=8) :: i16 write(*,*) huge(i16) 9223372036854775807 -- | David Duffy (MBBS PhD) ,-_|\ | email: dav...@qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / * | Epidemiology Unit, Queensland Institute of Medical Research \_,-._/ | 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.