]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/expint_data.cpp
import quincy beta 17.1.0
[ceph.git] / 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)
5
6 #include "mp_t.hpp"
7 #include <boost/math/special_functions/expint.hpp>
8 #include <boost/math/constants/constants.hpp>
9 #include <fstream>
10 #include <boost/math/tools/test_data.hpp>
11
12 using namespace boost::math::tools;
13
14 struct expint_data_generator
15 {
16 mp_t operator()(mp_t a, mp_t b)
17 {
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;
22 return result;
23 }
24 };
25
26
27 int main()
28 {
29 boost::math::expint(1, 0.06227754056453704833984375);
30 std::cout << boost::math::expint(1, mp_t(0.5)) << std::endl;
31
32 parameter_info<mp_t> arg1, arg2;
33 test_data<mp_t> data;
34
35 std::cout << "Welcome.\n"
36 "This program will generate spot tests for the expint function:\n"
37 " expint(a, b)\n\n";
38
39 bool cont;
40 std::string line;
41
42 do{
43 get_user_parameter_info(arg1, "a");
44 get_user_parameter_info(arg2, "b");
45 data.insert(expint_data_generator(), arg1, arg2);
46
47 std::cout << "Any more data [y/n]?";
48 std::getline(std::cin, line);
49 boost::algorithm::trim(line);
50 cont = (line == "y");
51 }while(cont);
52
53 std::cout << "Enter name of test data file [default=expint_data.ipp]";
54 std::getline(std::cin, line);
55 boost::algorithm::trim(line);
56 if(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");
61
62 return 0;
63 }
64