Skip to content
Prev 42217 / 63424 Next

inconsistent overflow handling by strtoi() on 32-bit Windows

Using the precompiled R 2.14.1 on 32-bit Windows XP strtoi(x)
gives 2^31-1 for x>2^31-1 but NA when x goes out of range
in the negative direction:
int [1:4] 2147483646 2147483647 2147483647 2147483647
int [1:4] -2147483646 -2147483647 NA NA
R version 2.14.1 (2011-12-22)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base  

On 64-bit Linux overflow in the either direction gives NA.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com