search for: integerfromr

Displaying 3 results from an estimated 3 matches for "integerfromr".

2001 May 10
1
Re: PR#929 and [R] matrix: suspected integer overflow
...o 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...
2001 May 09
1
matrix: suspected integer overflow
Is the following a known issue, in particular in terms of message clarity of the latter two? > 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 # looks better for arrays: > array (0, c(20, 10^10))
2010 Sep 08
0
Correction to vec-subset speed patch
...(ns == 1) +#endif + if (TYPEOF(s) == INTSXP) { + int i = INTEGER(s)[0]; + if (0 < i && i <= nx) { + *stretch = 0; + return s; + } + } else if (TYPEOF(s) == REALSXP) { + int i, warn = 0; + i = IntegerFromReal (REAL(s)[0], &warn); + if (0 < i && i <= nx) { + if (warn) CoercionWarning(warn); + *stretch = 0; + return ScalarInteger(i); + } + } -static SEXP -int_vectorSubscript(int nx, SEXP s, int *stretch, AttrG...