Logo ROOT  
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#include <limits>
13
14namespace ROOT {
15
16 namespace Minuit2 {
17
18
20 // use double precision values from the numeric_limits standard
21 // and do not determine it anymore using ComputePrecision
22 // epsilon from stundard
23 // note that there is a factor of 2 in the definition of
24 // std::numeric_limitys::epsilon w.r.t DLAMCH epsilon
25
27 fEpsMa2 = 2.*sqrt(fEpsMac);
28}
30 fEpsMac = 4.0E-7;
31 fEpsMa2 = 2.*sqrt(fEpsMac);
32
33 //determine machine precision using
34 // code similar to DLAMCH LAPACK Fortran function
35 /*
36 char e[] = {"e"};
37 fEpsMac = 8.*dlamch_(e);
38 fEpsMa2 = 2.*sqrt(fEpsMac);
39 */
40
41 MnTiny mytiny;
42
43 //calculate machine precision
44 double epstry = 0.5;
45 double epsbak = 0.;
46 volatile double epsp1 = 0.; // allow to run this method with fast-math
47 double one = 1.0;
48 for(int i = 0; i < 100; i++) {
49 epstry *= 0.5;
50 epsp1 = one + epstry;
51 epsbak = mytiny(epsp1);
52 if(epsbak < epstry) {
53 fEpsMac = 8.*epstry;
54 fEpsMa2 = 2.*sqrt(fEpsMac);
55 break;
56 }
57 }
58
59}
60
61 } // namespace Minuit2
62
63} // namespace ROOT
double sqrt(double)
void ComputePrecision()
compute Machine precision directly instead of using default values from std::numeric_limits
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
REAL epsilon
Definition: triangle.c:617