[Rcpp-commits] r3400 - in pkg/int64: . inst inst/include/int64 man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Nov 27 22:56:48 CET 2011


Author: romain
Date: 2011-11-27 22:56:48 +0100 (Sun, 27 Nov 2011)
New Revision: 3400

Modified:
   pkg/int64/ChangeLog
   pkg/int64/DESCRIPTION
   pkg/int64/inst/NEWS
   pkg/int64/inst/include/int64/math.h
   pkg/int64/man/int64-package.Rd
Log:
release 1.1.1

Modified: pkg/int64/ChangeLog
===================================================================
--- pkg/int64/ChangeLog	2011-11-26 19:44:31 UTC (rev 3399)
+++ pkg/int64/ChangeLog	2011-11-27 21:56:48 UTC (rev 3400)
@@ -1,5 +1,9 @@
 2011-11-26  Romain Francois  <romain at r-enthusiasts.com>
 
+    * inst/include/int64/math.h: log method for [u]int64
+
+2011-11-26  Romain Francois  <romain at r-enthusiasts.com>
+
     * R/int64.R: str and log10 methods for [u]int64 as requested by Hadley Wickham
 
 2011-11-23  Romain Francois  <romain at r-enthusiasts.com>

Modified: pkg/int64/DESCRIPTION
===================================================================
--- pkg/int64/DESCRIPTION	2011-11-26 19:44:31 UTC (rev 3399)
+++ pkg/int64/DESCRIPTION	2011-11-27 21:56:48 UTC (rev 3400)
@@ -1,8 +1,8 @@
 Package: int64
 Type: Package
 Title: 64 bit integer types
-Version: 1.2.0
-Date: 2011-11-21
+Version: 1.1.1
+Date: 2011-11-27
 Author: Romain Francois, sponsored by the Google Open Source Programs Office
 Maintainer: Romain Francois <romain at r-enthusiasts.com>
 Description: 64 bit integer types

Modified: pkg/int64/inst/NEWS
===================================================================
--- pkg/int64/inst/NEWS	2011-11-26 19:44:31 UTC (rev 3399)
+++ pkg/int64/inst/NEWS	2011-11-27 21:56:48 UTC (rev 3400)
@@ -1,8 +1,8 @@
-1.2.0   2011-yy-zz
+1.1.1   2011-11-27
 
     o   str methods for [u]int64 classes. Requested by @hadleywickham
     
-    o   log10 method for [u]int64 classes. Requested by @hadleywickham
+    o   log and log10 method for [u]int64 classes. Requested by @hadleywickham
 
 1.1.0   2011-11-24
 

Modified: pkg/int64/inst/include/int64/math.h
===================================================================
--- pkg/int64/inst/include/int64/math.h	2011-11-26 19:44:31 UTC (rev 3399)
+++ pkg/int64/inst/include/int64/math.h	2011-11-27 21:56:48 UTC (rev 3400)
@@ -152,6 +152,8 @@
         tmp = data.get(i) ;
         if( tmp == na ) {
             p_res[i] = NA_REAL;
+        } else if( tmp < 1){
+            p_res[i] = R_NaN ;
         } else {
             p_res[i] = (double) log10( (long double)data.get(i) ) ;   
         }
@@ -161,6 +163,30 @@
 }
 
 template <typename LONG>
+SEXP int64_log( SEXP x ){
+    Rint64::LongVector<LONG> data(x) ;
+    int n = data.size() ;
+    const LONG na = long_traits<LONG>::na() ;
+    SEXP res = PROTECT( Rf_allocVector( REALSXP, n ) ) ;
+    double* p_res = REAL(res) ;
+    LONG tmp; 
+    for(int i=0; i<n; i++){
+        tmp = data.get(i) ;
+        if( tmp == na ) {
+            p_res[i] = NA_REAL;
+        } else if( tmp <= 0 ){
+            p_res[i] = R_NaN ;
+        } else {
+            p_res[i] = (double) log( (long double)data.get(i) ) ;   
+        }
+    }
+    UNPROTECT(1) ; // res
+    return res ;
+}
+
+
+
+template <typename LONG>
 SEXP math( const char* op, SEXP x ){
     
     if( !strncmp( op, "abs", 3 ) ){
@@ -181,6 +207,8 @@
         return cumsum<LONG>( x ) ;   
     } else if( !strncmp( op, "log10", 5 ) ){
         return int64_log10<LONG>( x ) ;   
+    } else if( !strncmp( op, "log", 3 ) ){
+        return int64_log<LONG>( x) ;   
     }
     
     Rf_error( "generic not implemented" );

Modified: pkg/int64/man/int64-package.Rd
===================================================================
--- pkg/int64/man/int64-package.Rd	2011-11-26 19:44:31 UTC (rev 3399)
+++ pkg/int64/man/int64-package.Rd	2011-11-27 21:56:48 UTC (rev 3400)
@@ -11,8 +11,8 @@
 \tabular{ll}{
 Package: \tab int64\cr
 Type: \tab Package\cr
-Version: \tab 1.2.0\cr
-Date: \tab 2011-10-23\cr
+Version: \tab 1.1.1\cr
+Date: \tab 2011-10-27\cr
 License: \tab GPL (>= 2)\cr
 LazyLoad: \tab yes\cr
 }



More information about the Rcpp-commits mailing list