On Thu, Oct 20, 2011 at 7:50 AM, David Winsemius <dwinsem...@comcast.net> wrote: > > On Oct 20, 2011, at 1:45 AM, Lei Jiang wrote: > >> When using power operator ^, both the base and index are coerced to type >> "real". The range of "real" is larger than "integer". >> >> However, an ordinary multiplication operator * offers it to two integers >> (as >> always). >> >> So, to avoid the warning, just add "as.real(...)" to one or both >> multipliers >> (once one multiplier is "real", the other must be coerced to "real" in the >> operation): >> >>> sum(1000:1205)*as.real(sum(1000:1205)) >> >> [1] 51581223225 > > That does seem to be an infelicity that ought to be fixed. Using the infix > addition operator does that same sort of coercions, so why would one expect > the infix multiplication operator to refuse to do it?
This turns out not to be the case: > x<-2147483647L > y<-2147483647L > x+y [1] NA Warning message: In x + y : NAs produced by integer overflow -thomas -- Thomas Lumley Professor of Biostatistics University of Auckland ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.