[Rd] 64bit integers

Tony Wilkes tony_@_w||ke@ @end|ng |rom out|ook@com
Wed Jan 29 21:48:51 CET 2025


Hi everyone,

Thank you all for responding to my question.
I appreciate it.

Kind regards,

Tony

________________________________
Van: Prof Brian Ripley <ripleybd using icloud.com>
Verzonden: zondag 26 januari 2025 09:05
Aan: Simon Urbanek <simon.urbanek using R-project.org>; Tony Wilkes <tony_a_wilkes using outlook.com>
CC: r-devel using r-project.org <r-devel using r-project.org>
Onderwerp: Re: [Rd] 64bit integers

On 25/01/2025 23:37, Simon Urbanek wrote:
> Tony,
>
> Dirk sent a good response. I would like to add to that that it goes beyond just bits in SEXP: adding a new type involved in arithmetics is not only a lot of work but has performance implications. Also it is unclear how it should behave in the int32_t, double, int64_t triangle of vector classes in that respect (they don't nest) while retaining compatibility (doubles promote because they are a superset, but int64_t cannot do that). I am yet to see a real use-case where 53-bits are not sufficient in integer arithmetics so it is unclear that opening that big can of worms (and breaking things) would have any benefit. Typically, the only use-case for full 64-bit integers is as opaque 64-bit storage (e.g., randomly generated IDs) but there arithmetics make no sense there and packages are already covering that need.


Both Luke and I have looked into 64-bit integers, and not yet found them
a high enough priority.

Perhaps the most compelling motivation has not yet been mentioned. Array
dimensions (especially of matrices) and hence indices are restricted to
2^31-1, although total array size is limited by available storage.  If
we support more, people will expect to do matrix operations on such
matrices, and that is going to need versions of e.g. LAPACK which work
with 64-bit integers.  Modern Fortran allows different INTEGER sizes to
interwork, but most of the matrix code is not written in modern Fortran.
  If compiling them from source it would likely be possible to include
both 32-bit and 64-bit matrix libraries, but this will be tricky at best
with enhanced BLAS/LAPACK which often do have both 32- and 64-bit
versions but using the same entry-point names.

Ironically there were versions of S-PLUS with 64-bit integers.  But only
64-bit integers as in S pointers and integers had to be the same size.
That is not something we could contemplate for R, as vast numbers of
packages assume that R's integers map to C int (tested to be 32-bit) and
Fortran 32-bit INTEGER.

>
> Cheers,
> Simon
>
>
>> On Jan 25, 2025, at 11:08 PM, Tony Wilkes <tony_a_wilkes using outlook.com> wrote:
>>
>> Hi everyone,
>>
>> I heard somewhere that Core R is developing the implementation of true 64bit integers.
>> Is this true? If so, may I know what the status is of this development, and when, approximately, one can expect 64bit integers to be available in R?

It would have been helpful to tell us what you wanted to do with them.

>> Thank you for your time!
>>
>> Kind regards,
>>
>> Tony

--
Brian D. Ripley,                  ripley using stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford

	[[alternative HTML version deleted]]



More information about the R-devel mailing list