]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/factorial_tables.cpp
1 // (C) Copyright John Maddock 2007.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0. (See accompanying file
4 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #include <boost/limits.hpp>
10 void write_table(unsigned max_exponent
)
12 mp_t max
= ldexp(mp_t(1), (int)max_exponent
);
14 std::vector
<mp_t
> factorials
;
15 factorials
.push_back(1);
22 factorials
.push_back(f
);
28 // now write out the results to cout:
30 std::cout
<< std::scientific
<< std::setprecision(40);
31 std::cout
<< " static const std::array<T, " << factorials
.size() << "> factorials = {\n";
32 for(unsigned j
= 0; j
< factorials
.size(); ++j
)
33 std::cout
<< " " << factorials
[j
] << "L,\n";
34 std::cout
<< " };\n\n";
40 write_table(16384/*std::numeric_limits<float>::max_exponent*/);