Ignore:
Timestamp:
06/18/07 15:29:32 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r8563 r8578  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.33 2007-06-16 21:50:26 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.34 2007-06-18 14:29:32 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    691691        const Double_t sqrtd = TMath::Sqrt(D);
    692692
    693         const Double_t S = MMath::Sqrt3(R + sqrtd);
    694         const Double_t T = MMath::Sqrt3(R - sqrtd);
    695 
    696         x1 = (S+T) - a/3.;               // real root
     693        const Double_t A = TMah::Sign(1., R)*MMath::Sqrt3(TMath::Abs(R)+sqrtd);
     694
     695        // The case A==0 cannot happen. This would imply D==0
     696        // if (A==0)
     697        // {
     698        //     x1 = -a/3;
     699        //     return 1;
     700        // }
     701
     702        x1 = (A+Q/A)-a/3;
     703
     704        //const Double_t S = MMath::Sqrt3(R + sqrtd);
     705        //const Double_t T = MMath::Sqrt3(R - sqrtd);
     706        //x1 = (S+T) - a/3.;               // real root
    697707
    698708        return 1;
Note: See TracChangeset for help on using the changeset viewer.