]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/tgamma_large_data.cpp
1 // Copyright John Maddock 2013.
2 // Use, modification and distribution are subject to the
3 // Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
7 //[special_data_example
9 #include <boost/multiprecision/mpfr.hpp>
10 #include <boost/math/tools/test_data.hpp>
11 #include <boost/test/included/prg_exec_monitor.hpp>
12 #include <boost/math/tools/tuple.hpp>
15 using namespace boost::math::tools
;
16 using namespace boost::math
;
18 using namespace boost::multiprecision
;
20 typedef number
<mpfr_float_backend
<1000> > mp_type
;
23 boost::math::tuple
<mp_type
, mp_type
, mp_type
> generate(mp_type a
)
26 mpfr_gamma(tg
.backend().data(), a
.backend().data(), GMP_RNDN
);
27 mpfr_lngamma(lg
.backend().data(), a
.backend().data(), GMP_RNDN
);
28 return boost::math::make_tuple(a
, tg
, lg
);
31 int cpp_main(int argc
, char*argv
[])
33 parameter_info
<mp_type
> arg1
, arg2
;
34 test_data
<mp_type
> data
;
44 // User interface which prompts for
45 // range of input parameters:
47 if(0 == get_user_parameter_info(arg1
, "a"))
49 arg1
.type
|= dummy_param
;
51 data
.insert(&generate
, arg1
);
53 std::cout
<< "Any more data [y/n]?";
54 std::getline(std::cin
, line
);
55 boost::algorithm::trim(line
);
59 // Just need to write the results to a file:
61 std::cout
<< "Enter name of test data file [default=gamma.ipp]";
62 std::getline(std::cin
, line
);
63 boost::algorithm::trim(line
);
66 std::ofstream
ofs(line
.c_str());
67 line
.erase(line
.find('.'));
68 ofs
<< std::scientific
<< std::setprecision(500);
69 write_code(ofs
, data
, line
.c_str());