]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/expint_data.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)
7 #include <boost/math/special_functions/expint.hpp>
8 #include <boost/math/constants/constants.hpp>
10 #include <boost/math/tools/test_data.hpp>
12 using namespace boost::math::tools
;
14 struct expint_data_generator
16 mp_t
operator()(mp_t a
, mp_t b
)
18 unsigned n
= boost::math::tools::real_cast
<unsigned>(a
);
19 std::cout
<< n
<< " " << b
<< " ";
20 mp_t result
= boost::math::expint(n
, b
);
21 std::cout
<< result
<< std::endl
;
29 boost::math::expint(1, 0.06227754056453704833984375);
30 std::cout
<< boost::math::expint(1, mp_t(0.5)) << std::endl
;
32 parameter_info
<mp_t
> arg1
, arg2
;
35 std::cout
<< "Welcome.\n"
36 "This program will generate spot tests for the expint function:\n"
43 get_user_parameter_info(arg1
, "a");
44 get_user_parameter_info(arg2
, "b");
45 data
.insert(expint_data_generator(), arg1
, arg2
);
47 std::cout
<< "Any more data [y/n]?";
48 std::getline(std::cin
, line
);
49 boost::algorithm::trim(line
);
53 std::cout
<< "Enter name of test data file [default=expint_data.ipp]";
54 std::getline(std::cin
, line
);
55 boost::algorithm::trim(line
);
57 line
= "expint_data.ipp";
58 std::ofstream
ofs(line
.c_str());
59 ofs
<< std::scientific
<< std::setprecision(40);
60 write_code(ofs
, data
, "expint_data");