Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 8577)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 8578)
@@ -204,4 +204,5 @@
      - fixed the newly introduced EvlInteg(int, int) -- must
        return 0 explicitly if a==b
+     - fixed the upward search
 
 
Index: /trunk/MagicSoft/Mars/mbase/MMath.cc
===================================================================
--- /trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8577)
+++ /trunk/MagicSoft/Mars/mbase/MMath.cc	(revision 8578)
@@ -1,4 +1,4 @@
 /* ======================================================================== *\
-! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.33 2007-06-16 21:50:26 tbretz Exp $
+! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.34 2007-06-18 14:29:32 tbretz Exp $
 ! --------------------------------------------------------------------------
 !
@@ -691,8 +691,18 @@
         const Double_t sqrtd = TMath::Sqrt(D);
 
-        const Double_t S = MMath::Sqrt3(R + sqrtd);
-        const Double_t T = MMath::Sqrt3(R - sqrtd);
-
-        x1 = (S+T) - a/3.;               // real root
+        const Double_t A = TMah::Sign(1., R)*MMath::Sqrt3(TMath::Abs(R)+sqrtd);
+
+        // The case A==0 cannot happen. This would imply D==0
+        // if (A==0)
+        // {
+        //     x1 = -a/3;
+        //     return 1;
+        // }
+
+        x1 = (A+Q/A)-a/3;
+
+        //const Double_t S = MMath::Sqrt3(R + sqrtd);
+        //const Double_t T = MMath::Sqrt3(R - sqrtd);
+        //x1 = (S+T) - a/3.;               // real root
 
         return 1;
