Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:44

0001 #include <cmath>
0002 #include <cstdio>
0003 #include <iostream>
0004 
0005 
0006 inline double fastPow(double a, double b) {
0007   union {
0008     double d;
0009     int x[2];
0010   } u = { a };
0011   u.x[1] = (int)(b * (u.x[1] - 1072632447) + 1072632447);
0012   u.x[0] = 0;
0013   return u.d;
0014 }
0015 
0016 
0017 
0018 int main() {
0019   constexpr double Safety = 0.9;
0020   double eps=1.e-5;
0021   const float cut = std::pow(10.f/Safety,5.f);
0022   double accMin = eps/cut;
0023   std::cout << "eps/cut/accMin " << eps << " " << cut << " " << accMin
0024         << std::endl;
0025   for (double acc=accMin; acc<eps;  acc*=10.)
0026     std::cout << acc << " " << std::pow(eps/acc,0.2f) << " " << fastPow(eps/acc,0.2f) << std::endl;
0027 
0028   return 0;
0029 
0030 
0031 }