Skip to content
Prev 53621 / 63424 Next

sum() returns NA on a long *logical* vector when nb of TRUE values exceeds 2^31

Hi Martin,
On 06/07/2017 03:54 AM, Martin Maechler wrote:
No worries. Thanks for taking my proposal into consideration.
Note that the isum() function in src/main/summary.c is already using
a 64-bit accumulator to accommodate intermediate sums > INT_MAX.
So it should be easy to modify the function to make it overflow for
much bigger final sums without altering performance. Seems like
R_XLEN_T_MAX would be the natural threshold.

Cheers,
H.