Logo ROOT  
Reference Guide
MnMachinePrecision.h
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 #ifndef ROOT_Minuit2_MnMachinePrecision
11 #define ROOT_Minuit2_MnMachinePrecision
12 
13 #include <cmath>
14 
15 namespace ROOT {
16 
17 namespace Minuit2 {
18 
19 /**
20  Sets the relative floating point (double) arithmetic precision.
21  By default the precision values are obtained from the standard functions
22  std::numeric_limits<double>::epsilon.
23  The values can optionally be computed directly using the ComputePrecision()
24  member function. For a IEEE standard floating point arithmetic the computed values and
25  the one from std::numeric_limits<double>::epsilon are the same.
26 
27  SetPrecision() method can instead be used to override Minuit's own determination,
28  when the user knows that the {FCN} function Value is not calculated to
29  the nominal machine accuracy.
30  */
31 
33 
34 public:
36 
37  /// eps returns the smallest possible number so that 1.+eps > 1.
38  double Eps() const { return fEpsMac; }
39 
40  /// eps2 returns 2*sqrt(eps)
41  double Eps2() const { return fEpsMa2; }
42 
43  /// override Minuit's own determination
44  void SetPrecision(double prec)
45  {
46  fEpsMac = prec;
47  fEpsMa2 = 2. * std::sqrt(fEpsMac);
48  }
49 
50  /// compute Machine precision directly instead
51  /// of using default values from std::numeric_limits
52  void ComputePrecision();
53 
54 private:
55  double fEpsMac;
56  double fEpsMa2;
57 };
58 
59 } // namespace Minuit2
60 
61 } // namespace ROOT
62 
63 #endif // ROOT_Minuit2_MnMachinePrecision
ROOT::Minuit2::MnMachinePrecision::Eps2
double Eps2() const
eps2 returns 2*sqrt(eps)
Definition: MnMachinePrecision.h:41
ROOT::Minuit2::MnMachinePrecision::MnMachinePrecision
MnMachinePrecision()
Definition: MnMachinePrecision.cxx:18
ROOT::Minuit2::MnMachinePrecision::Eps
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
Definition: MnMachinePrecision.h:38
ROOT::Minuit2::MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
Definition: MnMachinePrecision.h:32
sqrt
double sqrt(double)
ROOT::Minuit2::MnMachinePrecision::fEpsMa2
double fEpsMa2
Definition: MnMachinePrecision.h:56
ROOT::Minuit2::MnMachinePrecision::ComputePrecision
void ComputePrecision()
compute Machine precision directly instead of using default values from std::numeric_limits
Definition: MnMachinePrecision.cxx:29
ROOT::Minuit2::MnMachinePrecision::SetPrecision
void SetPrecision(double prec)
override Minuit's own determination
Definition: MnMachinePrecision.h:44
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::Minuit2::MnMachinePrecision::fEpsMac
double fEpsMac
Definition: MnMachinePrecision.h:55