[Rd] NAs produced by integer overflow (PR#10482)

stgries at gmail.com stgries at gmail.com
Sat Dec 1 01:40:35 CET 2007


Full_Name: Stefan Th. Gries
Version: R version 2.6.1 (2007-11-26)
OS: Windows XP Home SP2
Submission from: (NULL) (68.6.47.105)


Hi

A simple computation results in integer overflow:

These are the relevant vectors:

> sum(cur.obs)
[1] 110231

> colfreq
      other        past     perfect     present progressive 
      14845        1222        4776      101347        2863 

> sum(colfreq)
[1] 125053

Now ...

# this works ...
> sum(cur.obs)*(colfreq/sum(colfreq)) # note: brackets around the division
      other        past     perfect     present progressive 
  13085.485    1077.162    4209.921   89334.771    2523.661 

# and this doesn't ...
> sum(cur.obs)*colfreq/sum(colfreq) # note: no brackets around the division
      other        past     perfect     present progressive 
  13085.485    1077.162    4209.921                2523.661 
Warning message:
In sum(cur.obs) * colfreq : NAs produced by integer overflow



I saw this was reported for R 2.3.0 and 2.6.0 before, but I don't know whether
it ever got dealt with. Here's my version information:

# -------------------------------------
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          6.1                         
year           2007                        
month          11                          
day            26                          
svn rev        43537                       
language       R                           
version.string R version 2.6.1 (2007-11-26)
# -------------------------------------

STG



More information about the R-devel mailing list