Logo ROOT   master
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 <math.h>
14 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 
20 /**
21  Sets the relative floating point (double) arithmetic precision.
22  By default the precision values are obtained from the standard functions
23  std::numeric_limits<double>::epsilon.
24  The values can optionally be computed directly using the ComputePrecision()
25  member function. For a IEEE standard floating point arithmetic the computed values and
26  the one from std::numeric_limits<double>::epsilon are the same.
27 
28  SetPrecision() method can instead be used to override Minuit's own determination,
29  when the user knows that the {FCN} function Value is not calculated to
30  the nominal machine accuracy.
31  */
32 
34 
35 public:
36 
38 
39 
40  /// eps returns the smallest possible number so that 1.+eps > 1.
41  double Eps() const {return fEpsMac;}
42 
43  /// eps2 returns 2*sqrt(eps)
44  double Eps2() const {return fEpsMa2;}
45 
46  /// override Minuit's own determination
47  void SetPrecision(double prec) {
48  fEpsMac = prec;
49  fEpsMa2 = 2.*sqrt(fEpsMac);
50  }
51 
52  /// compute Machine precision directly instead
53  /// of using default values from std::numeric_limits
54  void ComputePrecision();
55 
56 private:
57 
58  double fEpsMac;
59  double fEpsMa2;
60 };
61 
62  } // namespace Minuit2
63 
64 } // namespace ROOT
65 
66 #endif // ROOT_Minuit2_MnMachinePrecision
Returns the available number of logical cores.
Definition: RNumpyDS.hxx:30
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
Sets the relative floating point (double) arithmetic precision.
double sqrt(double)
double Eps2() const
eps2 returns 2*sqrt(eps)
void ComputePrecision()
compute Machine precision directly instead of using default values from std::numeric_limits ...
void SetPrecision(double prec)
override Minuit&#39;s own determination