[R] "sum" bug?
W.Simpson at gcal.ac.uk
Fri Mar 22 09:52:55 CET 2002
I sent a similar message to R-help a few months ago with the same subject!
The basic problem is that sum doesn't automatically coerce to double,
which suprised both you and me. Thus you got integer overflow (doubles
have a much larger dynamic range so won't overflow).
If you had done sum(dep*1.0) that would
have worked as well because operations like * and / do return a double
result, and sum() on a double returns a double.
It's confusing to me how numbers are stored as integer:
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help