Logo ROOT   6.13/01
Reference Guide
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 
11 #include "Minuit2/MnTiny.h"
12 
13 namespace ROOT {
14 
15  namespace Minuit2 {
16 
17 
19  fEpsMac(4.0E-7),
20  fEpsMa2(2.*sqrt(4.0E-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
Namespace for new ROOT classes and functions.
Definition: TFoamSampler.h:19
double sqrt(double)
constexpr Double_t E()
Base of natural log: .
Definition: TMath.h:97