File indexing completed on 2024-04-06 12:04:42
0001 #include <cmath>
0002 #include "DataFormats/Math/interface/approx_asin.h"
0003
0004
0005 float arc(float c, float d) {
0006 float z = 0.5f * c * d;
0007 z *= z;
0008 float x = d;
0009
0010 return ((((4.2163199048E-2f * z + 2.4181311049E-2f) * z + 4.5470025998E-2f) * z + 7.4953002686E-2f) * z +
0011 1.6666752422E-1f) *
0012 z * x +
0013 x;
0014 }
0015
0016 #include <iostream>
0017 int main() {
0018 float d = 10;
0019 for (float c = 0.1; c > 1.e-20; c *= 0.75)
0020 std::cout << c << " " << 2. * asin(0.5 * double(c) * double(d)) / double(c) << " "
0021 << 2.f * std::asin(0.5f * c * d) / c << " " << 2.f * unsafe_asin07<5>(0.5f * c * d) / c << " "
0022 << arc(c, d) << std::endl;
0023
0024 for (float c = -3.15; c < 3.15; c += 0.1)
0025 std::cout << c << " " << std::sin(c) << ' ' << std::cos(c) << ' ' << unsafe_asin07<5>(std::sin(c)) << ' '
0026 << unsafe_acos07<5>(std::cos(c)) << ' ' << unsafe_asin71<5>(std::sin(c)) << ' '
0027 << unsafe_acos71<5>(std::cos(c)) << ' ' << unsafe_asin<5>(std::sin(c)) << ' '
0028 << unsafe_acos<5>(std::cos(c)) << ' ' << std::endl;
0029
0030 for (float c = -1; c < 1.05; c += 0.1) {
0031 auto d = std::acos(c) - unsafe_acos<11>(c);
0032 auto e = std::asin(c) - unsafe_asin<11>(c);
0033 std::cout << c << ' ' << d << ' ' << e << std::endl;
0034 }
0035
0036 return 0;
0037 }