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