[Rd] request for use cases for larger integers in R
Heather Turner
ht @end|ng |rom he@therturner@net
Wed Sep 2 21:17:18 CEST 2026
Reviewing some of the old issues on the R Contribution Working Group repo (where sometimes we get wishlist items for R even though it is not really the right place...) I found this issue, which I copy here as it is short:
> Many R packages still use the legacy .C()/.Fortran() function to call C/Fortran codes. When a long vector is used with these packages, integer overflow may happen. However, I have never seen any warnings of this issue in these packages. I am not sure how R could deal with this situation without introducing 64-bit integer.
> -- waynelapierre
> https://github.com/r-devel/rcwg/issues/41
On Tue, Aug 11, 2026, at 3:48 PM, Hugo Gruson wrote:
> Adding my use case but it mostly aligns with what others have already
> mentioned, with a couple of additional explicit highlights:
>
> I am maintaining a couple of packages that ingest data from binary files
> generated from other languages. It is not uncommon to have to read
> int64, uint32 or uint64 from these binary files.
>
> Currently, I have to use custom code, usually in C, to read these types
> & convert them to int32 if they can fit and convert to NA / double /
> bit64 otherwise depending on the case. I would be delighted to be able
> to remove this custom code and rely on native support for larger integers.
>
> Compared to other answers, I would like to insist on two points, which
> may very well already be included in your proposal:
>
> - the same issue exists for uint32 & uint64 so a solution addressing
> these would provide even more value than a solution just for signed int64
>
> - it would be great if these new data types were usable directly with
> readBin() / writeBin()
>
> Best wishes,
>
> Hugo
>
> On 24/07/2026 20:04, luke-tierney--- via R-devel wrote:
>> R integers are current limited to a magnitude ot 2^31 - 1. Integer
>> values up to a magnitude of 2^53 can be represented exatcly as
>> doubles. At times it would be useful to be able to handle larger
>> values.
>>
>> Several options for adding support for large integers to R are under
>> consideration, each with advantages and disadvantages. To help with
>> deciding how to move forward it would be helpful to have a collection
>> of use cases where something is either difficult or impossible to
>> achieve with the current R integer representations. Examples would be
>> most helpful if they are concrete enough to allow us to build test
>> cases.
>>
>> Thanks,
>>
>> luke
>>
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
More information about the R-devel
mailing list