ROOT
6.13/01
Reference Guide
math
minuit2
src
MnMachinePrecision.cxx
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
#include "
Minuit2/MnMachinePrecision.h
"
11
#include "
Minuit2/MnTiny.h
"
12
13
namespace
ROOT
{
14
15
namespace
Minuit2 {
16
17
18
MnMachinePrecision::MnMachinePrecision
() :
19
fEpsMac(4.0
E
-7),
20
fEpsMa2(2.*
sqrt
(4.0
E
-7)) {
21
22
//determine machine precision
23
/*
24
char e[] = {"e"};
25
fEpsMac = 8.*dlamch_(e);
26
fEpsMa2 = 2.*sqrt(fEpsMac);
27
*/
28
29
// std::cout<<"machine precision eps: "<<Eps()<<std::endl;
30
31
MnTiny
mytiny;
32
33
//calculate machine precision
34
double
epstry = 0.5;
35
double
epsbak = 0.;
36
volatile
double
epsp1 = 0.;
// allow to run this method with fast-math
37
double
one = 1.0;
38
for
(
int
i = 0; i < 100; i++) {
39
epstry *= 0.5;
40
epsp1 = one + epstry;
41
epsbak = mytiny(epsp1);
42
if
(epsbak < epstry) {
43
fEpsMac
= 8.*epstry;
44
fEpsMa2
= 2.*
sqrt
(
fEpsMac
);
45
break
;
46
}
47
}
48
49
}
50
51
}
// namespace Minuit2
52
53
}
// namespace ROOT
ROOT
Namespace for new ROOT classes and functions.
Definition:
TFoamSampler.h:19
sqrt
double sqrt(double)
MnMachinePrecision.h
ROOT::Minuit2::MnMachinePrecision::fEpsMa2
double fEpsMa2
Definition:
MnMachinePrecision.h:58
MnTiny.h
TMath::E
constexpr Double_t E()
Base of natural log: .
Definition:
TMath.h:97
ROOT::Minuit2::MnMachinePrecision::fEpsMac
double fEpsMac
Definition:
MnMachinePrecision.h:57
ROOT::Minuit2::MnTiny
Definition:
MnTiny.h:18
ROOT::Minuit2::MnMachinePrecision::MnMachinePrecision
MnMachinePrecision()
Definition:
MnMachinePrecision.cxx:18