[mlpack-git] master: Replace numeric_limits::min() by numeric_limits::lowest() since min() returns the lowest positive for floating point datatypes (f77416e)

gitdub at mlpack.org gitdub at mlpack.org
Mon Mar 14 14:40:33 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/d9e7edd6c8b068f80c055204f3bb2bb0f2534b26...f77416e9ab5bb5d327805f7cb61bf206431ddfed

>---------------------------------------------------------------

commit f77416e9ab5bb5d327805f7cb61bf206431ddfed
Author: Mikhail Lozhnikov <lozhnikovma at gmail.com>
Date:   Thu Mar 10 14:28:40 2016 +0300

    Replace numeric_limits::min() by numeric_limits::lowest() since min() returns the lowest positive for floating point datatypes


>---------------------------------------------------------------

f77416e9ab5bb5d327805f7cb61bf206431ddfed
 src/mlpack/core/tree/ballbound_impl.hpp                     | 4 ++--
 src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mlpack/core/tree/ballbound_impl.hpp b/src/mlpack/core/tree/ballbound_impl.hpp
index 66d6a12..1957c21 100644
--- a/src/mlpack/core/tree/ballbound_impl.hpp
+++ b/src/mlpack/core/tree/ballbound_impl.hpp
@@ -20,7 +20,7 @@ namespace bound {
 //! Empty Constructor.
 template<typename VecType, typename TMetricType>
 BallBound<VecType, TMetricType>::BallBound() :
-    radius(std::numeric_limits<ElemType>::min()),
+    radius(std::numeric_limits<ElemType>::lowest()),
     metric(new TMetricType()),
     ownsMetric(true)
 { /* Nothing to do. */ }
@@ -32,7 +32,7 @@ BallBound<VecType, TMetricType>::BallBound() :
  */
 template<typename VecType, typename TMetricType>
 BallBound<VecType, TMetricType>::BallBound(const size_t dimension) :
-    radius(std::numeric_limits<ElemType>::min()),
+    radius(std::numeric_limits<ElemType>::lowest()),
     center(dimension),
     metric(new TMetricType()),
     ownsMetric(true)
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
index b033e14..c95eef6 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
@@ -865,7 +865,7 @@ bool RectangleTree<MetricType, StatisticType, MatType, SplitType, DescentType>::
       }
       else if (bound[i].Hi() == point[i])
       {
-        ElemType max = std::numeric_limits<ElemType>::min();
+        ElemType max = std::numeric_limits<ElemType>::lowest();
         for (size_t j = 0; j < count; j++)
         {
           if (localDataset->col(j)[i] > max)
@@ -905,7 +905,7 @@ bool RectangleTree<MetricType, StatisticType, MatType, SplitType, DescentType>::
       }
       else if (bound[i].Hi() == point[i])
       {
-        ElemType max = std::numeric_limits<ElemType>::min();
+        ElemType max = std::numeric_limits<ElemType>::lowest();
         for (size_t j = 0; j < numChildren; j++)
         {
           if (children[j]->Bound()[i].Hi() > max)
@@ -943,7 +943,7 @@ bool RectangleTree<MetricType, StatisticType, MatType, SplitType, DescentType>::
   {
     sum += bound[i].Width();
     bound[i].Lo() = std::numeric_limits<ElemType>::max();
-    bound[i].Hi() = std::numeric_limits<ElemType>::min();
+    bound[i].Hi() = std::numeric_limits<ElemType>::lowest();
   }
 
   for (size_t i = 0; i < numChildren; i++)




More information about the mlpack-git mailing list