MnMachinePrecision.h

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: MnMachinePrecision.h 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #ifndef ROOT_Minuit2_MnMachinePrecision
00011 #define ROOT_Minuit2_MnMachinePrecision
00012 
00013 #include <math.h>
00014 
00015 namespace ROOT {
00016 
00017    namespace Minuit2 {
00018 
00019 
00020 /** 
00021     determines the relative floating point arithmetic precision. The 
00022     SetPrecision() method can be used to override Minuit's own determination, 
00023     when the user knows that the {FCN} function Value is not calculated to 
00024     the nominal machine accuracy.
00025  */
00026 
00027 class MnMachinePrecision {
00028 
00029 public:
00030 
00031   MnMachinePrecision();
00032 
00033   ~MnMachinePrecision() {}
00034 
00035   MnMachinePrecision(const MnMachinePrecision& prec) : fEpsMac(prec.fEpsMac), fEpsMa2(prec.fEpsMa2) {}
00036 
00037   MnMachinePrecision& operator=(const MnMachinePrecision& prec) {
00038     fEpsMac = prec.fEpsMac;
00039     fEpsMa2 = prec.fEpsMa2;
00040     return *this;
00041   }
00042 
00043   /// eps returns the smallest possible number so that 1.+eps > 1.
00044   double Eps() const {return fEpsMac;}
00045 
00046   /// eps2 returns 2*sqrt(eps)
00047   double Eps2() const {return fEpsMa2;}
00048 
00049   /// override Minuit's own determination
00050   void SetPrecision(double prec) {
00051     fEpsMac = prec;
00052     fEpsMa2 = 2.*sqrt(fEpsMac);
00053   }
00054 
00055 private:
00056 
00057   double fEpsMac;
00058   double fEpsMa2;
00059 };
00060 
00061   }  // namespace Minuit2
00062 
00063 }  // namespace ROOT
00064 
00065 #endif  // ROOT_Minuit2_MnMachinePrecision

Generated on Tue Jul 5 14:25:44 2011 for ROOT_528-00b_version by  doxygen 1.5.1