|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85316 - sandbox/multiprecision.cpp_bin_float/libs/multiprecision/tools
From: john_at_[hidden]
Date: 2013-08-12 08:15:06
Author: johnmaddock
Date: 2013-08-12 08:15:06 EDT (Mon, 12 Aug 2013)
New Revision: 85316
URL: http://svn.boost.org/trac/boost/changeset/85316
Log:
Add some new files.
Added:
sandbox/multiprecision.cpp_bin_float/libs/multiprecision/tools/
sandbox/multiprecision.cpp_bin_float/libs/multiprecision/tools/sincos.cpp (contents, props changed)
Added: sandbox/multiprecision.cpp_bin_float/libs/multiprecision/tools/sincos.cpp
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ sandbox/multiprecision.cpp_bin_float/libs/multiprecision/tools/sincos.cpp 2013-08-12 08:15:06 EDT (Mon, 12 Aug 2013) (r85316)
@@ -0,0 +1,75 @@
+// Copyright John Maddock 2013.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt
+// or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+//[special_data_example
+
+#include <boost/multiprecision/mpfr.hpp>
+#include <boost/math/tools/test_data.hpp>
+#include <boost/test/included/prg_exec_monitor.hpp>
+#include <boost/math/tools/tuple.hpp>
+#include <fstream>
+
+using namespace boost::math::tools;
+using namespace boost::math;
+using namespace std;
+using namespace boost::multiprecision;
+
+typedef number<mpfr_float_backend<1000> > mp_type;
+
+
+boost::math::tuple<mp_type, mp_type, mp_type> generate(mp_type a)
+{
+ mp_type ts, tc;
+ ts = sin(a);
+ tc = cos(a);
+ return boost::math::make_tuple(a, ts, tc);
+}
+
+int cpp_main(int argc, char*argv [])
+{
+ parameter_info<mp_type> arg1, arg2;
+ test_data<mp_type> data;
+
+ bool cont;
+ std::string line;
+
+ if(argc < 1)
+ return 1;
+
+ do{
+ //
+ // User interface which prompts for
+ // range of input parameters:
+ //
+ if(0 == get_user_parameter_info(arg1, "a"))
+ return 1;
+ arg1.type |= dummy_param;
+
+ data.insert(&generate, arg1);
+
+ std::cout << "Any more data [y/n]?";
+ std::getline(std::cin, line);
+ boost::algorithm::trim(line);
+ cont = (line == "y");
+ }while(cont);
+ //
+ // Just need to write the results to a file:
+ //
+ std::cout << "Enter name of test data file [default=sincos.ipp]";
+ std::getline(std::cin, line);
+ boost::algorithm::trim(line);
+ if(line == "")
+ line = "sincos.ipp";
+ std::ofstream ofs(line.c_str());
+ line.erase(line.find('.'));
+ ofs << std::scientific << std::setprecision(500);
+ write_code(ofs, data, line.c_str());
+
+ return 0;
+}
+
+//]
+
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk