[R] Fortran and long integers
Earl F Glynn
efglynn at gmail.com
Mon Feb 7 06:21:57 CET 2011
Peter Langfelder wrote:
> Hi all,
>
> I'm hoping someone more knowledgeable in Fortran than I can chime in
> with opinion.
>
> I'm the maintainer of the flashClust package that implements fast
> hierarchical clustering. The fortran code fails when the number of
> clustered objects is larger than about 46300. My guess is that this is
> because the code uses the following construct:
2-byte (16 bit) signed integers would have a range from -32768 to
+37267. So, it looks like you may be using 2-byte integers and 46,300
would definitely cause an overflow with 16-bit integers.
I haven't used Fortran for a long time, but there could be a compiler
switch that forces all 2-byte integers, or a specific declaration that
says I, J, N, IOFFSET are only 2-byte (16-bit) integers.
I'm guess, but you might try a specification like
INTEGER*4 I, J, N, IOFFSET
assuming INTEGER*4 is legal with your Fortran compiler:
http://gcc.gnu.org/onlinedocs/gfortran/Old_002dstyle-kind-specifications.html#Old_002dstyle-kind-specifications
efg
Earl F Glynn
Overland Park, KS
More information about the R-help
mailing list