17 constexpr std::array factorials = {
32 uint64_t(87178291200),
33 uint64_t(1307674368000),
34 uint64_t(20922789888000),
35 uint64_t(355687428096000),
36 uint64_t(6402373705728000),
37 uint64_t(121645100408832000),
38 uint64_t(2432902008176640000),
41 if (n < factorials.size())
43 return factorials.at(n);
60 phi = std::asin(scale * std::sin(phi));
65 scale = std::sqrt(1.0 - m);
66 phi = 0.5 * M_PI - phi;
74 double per = std::floor((phi + 0.5 * M_PI) / M_PI);
75 phi = std::sin(phi) *
math::sgn(0.5 - std::abs(std::fmod(per, 2.0))) + 2 * per;
83 double b = std::sqrt(1.0 - m);
87 double pi2 = 0.5 * M_PI;
90 double c = 0.5 * (a - b);
91 if (std::abs(c) <= std::numeric_limits<double>::epsilon() * c) {
break; }
92 phi += std::atan((b / a) * std::tan(phi)) + M_PI * std::floor((phi + pi2) / M_PI);
93 cs += c * std::sin(phi);
97 if (am == a) {
break; }
101 double f =
sgn * phi / (twon * a);
102 phi = eok * f +
sgn * cs;
107 phi = (phi - (1.0 - m) * f) / scale;
109 else if (origM < 0.0)
111 phi = (eok * 0.5 * M_PI / a - phi) * scale;