[mlpack-svn] r13390 - mlpack/trunk/src/mlpack/methods/det

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Aug 13 16:37:28 EDT 2012


Author: rcurtin
Date: 2012-08-13 16:37:27 -0400 (Mon, 13 Aug 2012)
New Revision: 13390

Modified:
   mlpack/trunk/src/mlpack/methods/det/dtree.cpp
Log:
Fix floating point precision error which was causing issues only when compiled
with optimizations.  I suspect this to be a manifestation of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 and making one argument
volatile is proposed as a potential simple solution, which appears to work
here.


Modified: mlpack/trunk/src/mlpack/methods/det/dtree.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/det/dtree.cpp	2012-08-11 00:15:04 UTC (rev 13389)
+++ mlpack/trunk/src/mlpack/methods/det/dtree.cpp	2012-08-13 20:37:27 UTC (rev 13390)
@@ -431,7 +431,7 @@
   else
   {
     // Compute gT value for node t.
-    double gT;
+    volatile double gT;
     if (useVolReg)
       gT = alphaUpper;// - std::log(subtreeLeavesVTInv - vTInv);
     else
@@ -507,7 +507,7 @@
 
       Log::Assert(gT < std::numeric_limits<double>::max());
 
-      return std::min(gT, std::min(leftG, rightG));
+      return std::min((double) gT, std::min(leftG, rightG));
     }
     else
     {




More information about the mlpack-svn mailing list