ripley@stats.ox.ac.uk
2001-May-10 06:31 UTC
[Rd] Re: PR#929 and [R] matrix: suspected integer overflow
On Wed, 9 May 2001 andreas.krause@pharma.novartis.com wrote:> Is the following a known issue, in particular in terms of message clarity of the latter two?Yes, bug PR#929. It's a bug in asInteger, an internal C routine which using (int) on a double. coerce.c has better routines used to corce vectors, and the comment /* This section of code handles type conversion for elements */ /* of data vectors. Type coercion throughout R should use these */ /* routines to ensure consistency. */ ! I have altered asInteger (etc) to use the same routines. However, I am not happy with what IntegerFromReal does: it gives the maximum integer and the message. I think it would be much better to return NA in that cirumstance, when most uses of asInteger would give up (correctly) and generate a meaningful error. Comments, R-core?> > matrix(0, 10^8, 10^8) > Error: cannot allocate vector of size 2064896 Kb > > matrix(0, 20, 10^10) > Error in matrix(0, 20, 10^10) : negative length vectors are not allowed > > matrix(0, 10^10, 10^10) > Error: cannot allocate vector of size 0 Kb[...] -- Brian D. Ripley, ripley@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Peter Dalgaard BSA
2001-May-10 09:07 UTC
[Rd] Re: PR#929 and [R] matrix: suspected integer overflow
ripley@stats.ox.ac.uk writes:> However, I am not happy with what IntegerFromReal does: it gives the > maximum integer and the message. I think it would be much better to return > NA in that cirumstance, when most uses of asInteger would give up > (correctly) and generate a meaningful error. > > Comments, R-core?Agreed. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel 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-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._