[Rcpp-commits] r3977 - pkg/Rcpp/inst/include/Rcpp/sugar/functions

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 15 19:18:37 CET 2012


Author: romain
Date: 2012-11-15 19:18:37 +0100 (Thu, 15 Nov 2012)
New Revision: 3977

Modified:
   pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h
Log:
min, max, range

Modified: pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h	2012-11-15 18:14:45 UTC (rev 3976)
+++ pkg/Rcpp/inst/include/Rcpp/sugar/functions/minmax.h	2012-11-15 18:18:37 UTC (rev 3977)
@@ -65,6 +65,8 @@
                 current = obj[i] ;
                 if( Rcpp::traits::is_na<RTYPE>( current ) ) return Vector<RTYPE>::create( min_, max_ ) ;
                 if( current < min_ ) min_ = current ;
+                if( current > max_ ) max_ = current ;
+                
             }
             return Vector<RTYPE>::create( min_, max_ ) ;
         }
@@ -110,6 +112,7 @@
             for( int i=1; i<n; i++){
                 current = obj[i] ;
                 if( current < min_ ) min_ = current ;
+                if( current > max_ ) max_ = current ;
             }
             return Vector<RTYPE>::create( min_, max_ ) ;
         }



More information about the Rcpp-commits mailing list