[Rcpp-commits] r3331 - in pkg/int64: inst/include/int64 src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Nov 12 13:12:38 CET 2011
Author: romain
Date: 2011-11-12 13:12:38 +0100 (Sat, 12 Nov 2011)
New Revision: 3331
Modified:
pkg/int64/inst/include/int64/arith.h
pkg/int64/src/int64.cpp
Log:
deal with NA in signif
Modified: pkg/int64/inst/include/int64/arith.h
===================================================================
--- pkg/int64/inst/include/int64/arith.h 2011-11-12 11:19:20 UTC (rev 3330)
+++ pkg/int64/inst/include/int64/arith.h 2011-11-12 12:12:38 UTC (rev 3331)
@@ -52,8 +52,12 @@
return res ;
}
return na ;
-
-}
+}
+template <> inline uint64_t minus<uint64_t>( uint64_t x1, uint64_t x2){
+ const uint64_t na = int64::LongVector<uint64_t>::na ;
+ if( x1 == na || x2 == na || x2 > x1) return na ;
+ return x1 - x2 ;
+}
template <typename T> inline T times(T x1,T x2){
const T na = int64::LongVector<T>::na ;
if( x1 == na || x2 == na){
Modified: pkg/int64/src/int64.cpp
===================================================================
--- pkg/int64/src/int64.cpp 2011-11-12 11:19:20 UTC (rev 3330)
+++ pkg/int64/src/int64.cpp 2011-11-12 12:12:38 UTC (rev 3331)
@@ -196,7 +196,7 @@
SEXP res = PROTECT( Rf_allocVector( STRSXP, n ) ) ;
for( int i=0; i<n; i++){
- if( digits[i] > len[i] ){
+ if( !strcmp( CHAR(STRING_ELT(x_, i)), "NA" ) || digits[i] > len[i] ){
SET_STRING_ELT( res, i, STRING_ELT( s_, i ) ) ;
} else {
s = CHAR(STRING_ELT(s_, i ));
More information about the Rcpp-commits
mailing list