]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/tools/sinc_data.cpp
1 // (C) Copyright John Maddock 2006.
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/digamma.hpp>
8 #include <boost/test/included/prg_exec_monitor.hpp>
10 #include <boost/math/tools/test_data.hpp>
12 using namespace boost::math::tools
;
16 float force_truncate(const float* f
)
22 float truncate_to_float(mp_t r
)
24 float f
= boost::math::tools::real_cast
<float>(r
);
25 return force_truncate(&f
);
29 T
naive_sinc(T
const& x
)
35 int cpp_main(int argc
, char*argv
[])
37 parameter_info
<mp_t
> arg1
;
43 std::cout
<< "Welcome.\n"
44 "This program will generate spot tests for the sinc function:\n"
48 if(0 == get_user_parameter_info(arg1
, "z"))
50 data
.insert(&::naive_sinc
<mp_t
>, arg1
);
52 std::cout
<< "Any more data [y/n]?";
53 std::getline(std::cin
, line
);
54 boost::algorithm::trim(line
);
58 std::cout
<< "Enter name of test data file [default=sinc_data.ipp]";
59 std::getline(std::cin
, line
);
60 boost::algorithm::trim(line
);
62 line
= "sinc_data.ipp";
63 std::ofstream
ofs(line
.c_str());
64 ofs
<< std::scientific
<< std::setprecision(40);
65 write_code(ofs
, data
, "sinc_data");