Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
15namespace ROOT {
16
17namespace 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
34public:
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
54private:
55 double fEpsMac;
56 double fEpsMa2;
57};
58
59} // namespace Minuit2
60
61} // namespace ROOT
62
63#endif // ROOT_Minuit2_MnMachinePrecision
Sets the relative floating point (double) arithmetic precision.
void ComputePrecision()
compute Machine precision directly instead of using default values from std::numeric_limits
double Eps() const
eps returns the smallest possible number so that 1.+eps > 1.
void SetPrecision(double prec)
override Minuit's own determination
double Eps2() const
eps2 returns 2*sqrt(eps)
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.