• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define BOOST_MATH_POLY_METHOD 0
7 #define BOOST_MATH_RATIONAL_METHOD 0
8 
9 #include <boost/random.hpp>
10 #include <boost/math/tools/rational.hpp>
11 #include <iostream>
12 #include <fstream>
13 #include "mp_t.hpp"
14 
main()15 int main()
16 {
17    using namespace boost::math;
18    using namespace boost::math::tools;
19 
20    static const unsigned max_order = 20;
21    std::cout << std::scientific << std::setprecision(40);
22 
23    boost::mt19937 rnd;
24    boost::variate_generator<
25       boost::mt19937,
26       boost::uniform_int<> > gen(rnd, boost::uniform_int<>(1, 12));
27 
28    for(unsigned i = 1; i < max_order; ++i)
29    {
30       std::vector<int> coef;
31       for(unsigned j = 0; j < i; ++j)
32       {
33          coef.push_back(gen());
34       }
35       std::cout << std::scientific;
36       std::cout <<
37 "   //\n"
38 "   // Polynomials of order " << i-1 << "\n"
39 "   //\n"
40 "   static const U n" << i << "c[" << i << "] = { ";
41       for(unsigned j = 0; j < i; ++j)
42       {
43          if(j)
44             std::cout  << ", ";
45          std::cout << coef[j];
46       }
47       std::cout << " };\n";
48       std::cout <<
49          "   static const boost::array<U, " << i << "> n" << i << "a = { ";
50       for(unsigned j = 0; j < i; ++j)
51       {
52          if(j)
53             std::cout  << ", ";
54          std::cout << coef[j];
55       }
56       std::cout << " };\n";
57 
58       mp_t r1 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.125), i);
59       mp_t r2 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.25), i);
60       mp_t r3 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.75), i);
61       mp_t r4 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(1) - mp_t(1) / 64, i);
62       mp_t r5 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(6.5), i);
63       mp_t r6 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(10247.25), i);
64 
65       std::cout <<
66          "   BOOST_CHECK_CLOSE(\n"
67          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.125), " << i << "),\n"
68          "      static_cast<T>(" << r1 << "L),\n"
69          "      tolerance);\n";
70       std::cout <<
71          "   BOOST_CHECK_CLOSE(\n"
72          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.25), " << i << "),\n"
73          "      static_cast<T>(" << r2 << "L),\n"
74          "      tolerance);\n";
75       std::cout <<
76          "   BOOST_CHECK_CLOSE(\n"
77          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.75), " << i << "),\n"
78          "      static_cast<T>(" << r3 << "L),\n"
79          "      tolerance);\n";
80       std::cout <<
81          "   BOOST_CHECK_CLOSE(\n"
82          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
83          "      static_cast<T>(" << r4 << "L),\n"
84          "      tolerance);\n";
85       if(fabs(r5) < tools::max_value<float>())
86          std::cout <<
87             "   BOOST_CHECK_CLOSE(\n"
88             "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(6.5), " << i << "),\n"
89             "      static_cast<T>(" << r5 << "L),\n"
90             "      tolerance);\n";
91       if(fabs(r6) < tools::max_value<float>())
92          std::cout <<
93             "   BOOST_CHECK_CLOSE(\n"
94             "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(10247.25), " << i << "),\n"
95             "      static_cast<T>(" << r6 << "L),\n"
96             "      tolerance);\n\n";
97 
98       std::cout <<
99          "   BOOST_CHECK_CLOSE(\n"
100          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.125)),\n"
101          "      static_cast<T>(" << r1 << "L),\n"
102          "      tolerance);\n";
103       std::cout <<
104          "   BOOST_CHECK_CLOSE(\n"
105          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.25)),\n"
106          "      static_cast<T>(" << r2 << "L),\n"
107          "      tolerance);\n";
108       std::cout <<
109          "   BOOST_CHECK_CLOSE(\n"
110          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(0.75)),\n"
111          "      static_cast<T>(" << r3 << "L),\n"
112          "      tolerance);\n";
113       std::cout <<
114          "   BOOST_CHECK_CLOSE(\n"
115          "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
116          "      static_cast<T>(" << r4 << "L),\n"
117          "      tolerance);\n";
118       if(fabs(r5) < tools::max_value<float>())
119          std::cout <<
120             "   BOOST_CHECK_CLOSE(\n"
121             "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(6.5)),\n"
122             "      static_cast<T>(" << r5 << "L),\n"
123             "      tolerance);\n";
124       if(fabs(r6) < tools::max_value<float>())
125          std::cout <<
126             "   BOOST_CHECK_CLOSE(\n"
127             "      boost::math::tools::evaluate_polynomial(n" << i << "c, static_cast<T>(10247.25)),\n"
128             "      static_cast<T>(" << r6 << "L),\n"
129             "      tolerance);\n\n";
130 
131       std::cout <<
132          "   BOOST_CHECK_CLOSE(\n"
133          "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(0.125)),\n"
134          "      static_cast<T>(" << r1 << "L),\n"
135          "      tolerance);\n";
136       std::cout <<
137          "   BOOST_CHECK_CLOSE(\n"
138          "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(0.25)),\n"
139          "      static_cast<T>(" << r2 << "L),\n"
140          "      tolerance);\n";
141       std::cout <<
142          "   BOOST_CHECK_CLOSE(\n"
143          "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(0.75)),\n"
144          "      static_cast<T>(" << r3 << "L),\n"
145          "      tolerance);\n";
146       std::cout <<
147          "   BOOST_CHECK_CLOSE(\n"
148          "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
149          "      static_cast<T>(" << r4 << "L),\n"
150          "      tolerance);\n";
151       if(fabs(r5) < tools::max_value<float>())
152          std::cout <<
153             "   BOOST_CHECK_CLOSE(\n"
154             "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(6.5)),\n"
155             "      static_cast<T>(" << r5 << "L),\n"
156             "      tolerance);\n";
157       if(fabs(r6) < tools::max_value<float>())
158          std::cout <<
159             "   BOOST_CHECK_CLOSE(\n"
160             "      boost::math::tools::evaluate_polynomial(n" << i << "a, static_cast<T>(10247.25)),\n"
161             "      static_cast<T>(" << r6 << "L),\n"
162             "      tolerance);\n\n";
163 
164       r1 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(0.125), i);
165       r2 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(0.25), i);
166       r3 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(0.75), i);
167       r4 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(1) - mp_t(1) / 64, i);
168       r5 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(6.5), i);
169       r6 = boost::math::tools::evaluate_even_polynomial(&coef[0], mp_t(10247.25), i);
170 
171       std::cout <<
172          "   BOOST_CHECK_CLOSE(\n"
173          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.125), " << i << "),\n"
174          "      static_cast<T>(" << r1 << "L),\n"
175          "      tolerance);\n";
176       std::cout <<
177          "   BOOST_CHECK_CLOSE(\n"
178          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.25), " << i << "),\n"
179          "      static_cast<T>(" << r2 << "L),\n"
180          "      tolerance);\n";
181       std::cout <<
182          "   BOOST_CHECK_CLOSE(\n"
183          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.75), " << i << "),\n"
184          "      static_cast<T>(" << r3 << "L),\n"
185          "      tolerance);\n";
186       std::cout <<
187          "   BOOST_CHECK_CLOSE(\n"
188          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
189          "      static_cast<T>(" << r4 << "L),\n"
190          "      tolerance);\n";
191       if(fabs(r5) < tools::max_value<float>())
192          std::cout <<
193             "   BOOST_CHECK_CLOSE(\n"
194             "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
195             "      static_cast<T>(" << r5 << "L),\n"
196             "      tolerance);\n";
197       if(fabs(r6) < tools::max_value<float>())
198          std::cout <<
199             "   BOOST_CHECK_CLOSE(\n"
200             "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
201             "      static_cast<T>(" << r6 << "L),\n"
202             "      tolerance);\n\n";
203 
204       std::cout <<
205          "   BOOST_CHECK_CLOSE(\n"
206          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.125)),\n"
207          "      static_cast<T>(" << r1 << "L),\n"
208          "      tolerance);\n";
209       std::cout <<
210          "   BOOST_CHECK_CLOSE(\n"
211          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.25)),\n"
212          "      static_cast<T>(" << r2 << "L),\n"
213          "      tolerance);\n";
214       std::cout <<
215          "   BOOST_CHECK_CLOSE(\n"
216          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(0.75)),\n"
217          "      static_cast<T>(" << r3 << "L),\n"
218          "      tolerance);\n";
219       std::cout <<
220          "   BOOST_CHECK_CLOSE(\n"
221          "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
222          "      static_cast<T>(" << r4 << "L),\n"
223          "      tolerance);\n";
224       if(fabs(r5) < tools::max_value<float>())
225          std::cout <<
226             "   BOOST_CHECK_CLOSE(\n"
227             "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(6.5f)),\n"
228             "      static_cast<T>(" << r5 << "L),\n"
229             "      tolerance);\n";
230       if(fabs(r6) < tools::max_value<float>())
231          std::cout <<
232             "   BOOST_CHECK_CLOSE(\n"
233             "      boost::math::tools::evaluate_even_polynomial(n" << i << "c, static_cast<T>(10247.25f)),\n"
234             "      static_cast<T>(" << r6 << "L),\n"
235             "      tolerance);\n\n";
236 
237       std::cout <<
238          "   BOOST_CHECK_CLOSE(\n"
239          "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(0.125)),\n"
240          "      static_cast<T>(" << r1 << "L),\n"
241          "      tolerance);\n";
242       std::cout <<
243          "   BOOST_CHECK_CLOSE(\n"
244          "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(0.25)),\n"
245          "      static_cast<T>(" << r2 << "L),\n"
246          "      tolerance);\n";
247       std::cout <<
248          "   BOOST_CHECK_CLOSE(\n"
249          "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(0.75)),\n"
250          "      static_cast<T>(" << r3 << "L),\n"
251          "      tolerance);\n";
252       std::cout <<
253          "   BOOST_CHECK_CLOSE(\n"
254          "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
255          "      static_cast<T>(" << r4 << "L),\n"
256          "      tolerance);\n";
257       if(fabs(r5) < tools::max_value<float>())
258          std::cout <<
259             "   BOOST_CHECK_CLOSE(\n"
260             "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(6.5f)),\n"
261             "      static_cast<T>(" << r5 << "L),\n"
262             "      tolerance);\n";
263       if(fabs(r6) < tools::max_value<float>())
264          std::cout <<
265             "   BOOST_CHECK_CLOSE(\n"
266             "      boost::math::tools::evaluate_even_polynomial(n" << i << "a, static_cast<T>(10247.25f)),\n"
267             "      static_cast<T>(" << r6 << "L),\n"
268             "      tolerance);\n\n";
269 
270       if(i > 1)
271       {
272          r1 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(0.125), i);
273          r2 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(0.25), i);
274          r3 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(0.75), i);
275          r4 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(1) - mp_t(1) / 64, i);
276          r5 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(6.5), i);
277          r6 = boost::math::tools::evaluate_odd_polynomial(&coef[0], mp_t(10247.25), i);
278 
279          std::cout <<
280             "   BOOST_CHECK_CLOSE(\n"
281             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.125), " << i << "),\n"
282             "      static_cast<T>(" << r1 << "L),\n"
283             "      tolerance);\n";
284          std::cout <<
285             "   BOOST_CHECK_CLOSE(\n"
286             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.25), " << i << "),\n"
287             "      static_cast<T>(" << r2 << "L),\n"
288             "      tolerance);\n";
289          std::cout <<
290             "   BOOST_CHECK_CLOSE(\n"
291             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.75), " << i << "),\n"
292             "      static_cast<T>(" << r3 << "L),\n"
293             "      tolerance);\n";
294          std::cout <<
295             "   BOOST_CHECK_CLOSE(\n"
296             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
297             "      static_cast<T>(" << r4 << "L),\n"
298             "      tolerance);\n";
299          if(fabs(r5) < tools::max_value<float>())
300             std::cout <<
301                "   BOOST_CHECK_CLOSE(\n"
302                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
303                "      static_cast<T>(" << r5 << "L),\n"
304                "      tolerance);\n";
305          if(fabs(r6) < tools::max_value<float>())
306             std::cout <<
307                "   BOOST_CHECK_CLOSE(\n"
308                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
309                "      static_cast<T>(" << r6 << "L),\n"
310                "      tolerance);\n\n";
311 
312          std::cout <<
313             "   BOOST_CHECK_CLOSE(\n"
314             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.125)),\n"
315             "      static_cast<T>(" << r1 << "L),\n"
316             "      tolerance);\n";
317          std::cout <<
318             "   BOOST_CHECK_CLOSE(\n"
319             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.25)),\n"
320             "      static_cast<T>(" << r2 << "L),\n"
321             "      tolerance);\n";
322          std::cout <<
323             "   BOOST_CHECK_CLOSE(\n"
324             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(0.75)),\n"
325             "      static_cast<T>(" << r3 << "L),\n"
326             "      tolerance);\n";
327          std::cout <<
328             "   BOOST_CHECK_CLOSE(\n"
329             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
330             "      static_cast<T>(" << r4 << "L),\n"
331             "      tolerance);\n";
332          if(fabs(r5) < tools::max_value<float>())
333             std::cout <<
334                "   BOOST_CHECK_CLOSE(\n"
335                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(6.5f)),\n"
336                "      static_cast<T>(" << r5 << "L),\n"
337                "      tolerance);\n";
338          if(fabs(r6) < tools::max_value<float>())
339             std::cout <<
340                "   BOOST_CHECK_CLOSE(\n"
341                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "c, static_cast<T>(10247.25f)),\n"
342                "      static_cast<T>(" << r6 << "L),\n"
343                "      tolerance);\n\n";
344 
345          std::cout <<
346             "   BOOST_CHECK_CLOSE(\n"
347             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(0.125)),\n"
348             "      static_cast<T>(" << r1 << "L),\n"
349             "      tolerance);\n";
350          std::cout <<
351             "   BOOST_CHECK_CLOSE(\n"
352             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(0.25)),\n"
353             "      static_cast<T>(" << r2 << "L),\n"
354             "      tolerance);\n";
355          std::cout <<
356             "   BOOST_CHECK_CLOSE(\n"
357             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(0.75)),\n"
358             "      static_cast<T>(" << r3 << "L),\n"
359             "      tolerance);\n";
360          std::cout <<
361             "   BOOST_CHECK_CLOSE(\n"
362             "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
363             "      static_cast<T>(" << r4 << "L),\n"
364             "      tolerance);\n";
365          if(fabs(r5) < tools::max_value<float>())
366             std::cout <<
367                "   BOOST_CHECK_CLOSE(\n"
368                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(6.5f)),\n"
369                "      static_cast<T>(" << r5 << "L),\n"
370                "      tolerance);\n";
371          if(fabs(r6) < tools::max_value<float>())
372             std::cout <<
373                "   BOOST_CHECK_CLOSE(\n"
374                "      boost::math::tools::evaluate_odd_polynomial(n" << i << "a, static_cast<T>(10247.25f)),\n"
375                "      static_cast<T>(" << r6 << "L),\n"
376                "      tolerance);\n\n";
377       }
378 
379       r1 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.125), i);
380       r2 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.25), i);
381       r3 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.75), i);
382       r4 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(1) - mp_t(1) / 64, i);
383       r5 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(6.5), i);
384       r6 = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(10247.25), i);
385 
386       coef.clear();
387       for(unsigned j = 0; j < i; ++j)
388       {
389          coef.push_back(gen());
390       }
391       std::cout <<
392 "   //\n"
393 "   // Rational functions of order " << i-1 << "\n"
394 "   //\n"
395 "   static const U d" << i << "c[" << i << "] = { ";
396       for(unsigned j = 0; j < i; ++j)
397       {
398          if(j)
399             std::cout  << ", ";
400          std::cout << coef[j];
401       }
402       std::cout << " };\n";
403       std::cout <<
404          "   static const boost::array<U, " << i << "> d" << i << "a = { ";
405       for(unsigned j = 0; j < i; ++j)
406       {
407          if(j)
408             std::cout  << ", ";
409          std::cout << coef[j];
410       }
411       std::cout << " };\n";
412 
413       mp_t r1d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.125), i);
414       mp_t r2d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.25), i);
415       mp_t r3d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(0.75), i);
416       mp_t r4d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(1) - mp_t(1) / 64, i);
417       mp_t r5d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(6.5), i);
418       mp_t r6d = boost::math::tools::evaluate_polynomial(&coef[0], mp_t(10247.25), i);
419 
420       std::cout <<
421          "   BOOST_CHECK_CLOSE(\n"
422          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.125), " << i << "),\n"
423          "      static_cast<T>(" << r1/r1d << "L),\n"
424          "      tolerance);\n";
425       std::cout <<
426          "   BOOST_CHECK_CLOSE(\n"
427          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.25), " << i << "),\n"
428          "      static_cast<T>(" << r2/r2d << "L),\n"
429          "      tolerance);\n";
430       std::cout <<
431          "   BOOST_CHECK_CLOSE(\n"
432          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.75), " << i << "),\n"
433          "      static_cast<T>(" << r3/r3d << "L),\n"
434          "      tolerance);\n";
435       std::cout <<
436          "   BOOST_CHECK_CLOSE(\n"
437          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f), " << i << "),\n"
438          "      static_cast<T>(" << r4/r4d << "L),\n"
439          "      tolerance);\n";
440       if(fabs(r5/r5d) < tools::max_value<float>())
441          std::cout <<
442             "   BOOST_CHECK_CLOSE(\n"
443             "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(6.5f), " << i << "),\n"
444             "      static_cast<T>(" << r5/r5d << "L),\n"
445             "      tolerance);\n";
446       if(fabs(r6/r6d) < tools::max_value<float>())
447          std::cout <<
448             "   BOOST_CHECK_CLOSE(\n"
449             "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(10247.25f), " << i << "),\n"
450             "      static_cast<T>(" << r6/r6d << "L),\n"
451             "      tolerance);\n\n";
452 
453       std::cout <<
454          "   BOOST_CHECK_CLOSE(\n"
455          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.125)),\n"
456          "      static_cast<T>(" << r1/r1d << "L),\n"
457          "      tolerance);\n";
458       std::cout <<
459          "   BOOST_CHECK_CLOSE(\n"
460          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.25)),\n"
461          "      static_cast<T>(" << r2/r2d << "L),\n"
462          "      tolerance);\n";
463       std::cout <<
464          "   BOOST_CHECK_CLOSE(\n"
465          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(0.75)),\n"
466          "      static_cast<T>(" << r3/r3d << "L),\n"
467          "      tolerance);\n";
468       std::cout <<
469          "   BOOST_CHECK_CLOSE(\n"
470          "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
471          "      static_cast<T>(" << r4/r4d << "L),\n"
472          "      tolerance);\n";
473       if(fabs(r5/r5d) < tools::max_value<float>())
474          std::cout <<
475             "   BOOST_CHECK_CLOSE(\n"
476             "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(6.5f)),\n"
477             "      static_cast<T>(" << r5/r5d << "L),\n"
478             "      tolerance);\n";
479       if(fabs(r6/r6d) < tools::max_value<float>())
480          std::cout <<
481             "   BOOST_CHECK_CLOSE(\n"
482             "      boost::math::tools::evaluate_rational(n" << i << "c, d" << i << "c, static_cast<T>(10247.25f)),\n"
483             "      static_cast<T>(" << r6/r6d << "L),\n"
484             "      tolerance);\n\n";
485 
486       std::cout <<
487          "   BOOST_CHECK_CLOSE(\n"
488          "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(0.125)),\n"
489          "      static_cast<T>(" << r1/r1d << "L),\n"
490          "      tolerance);\n";
491       std::cout <<
492          "   BOOST_CHECK_CLOSE(\n"
493          "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(0.25)),\n"
494          "      static_cast<T>(" << r2/r2d << "L),\n"
495          "      tolerance);\n";
496       std::cout <<
497          "   BOOST_CHECK_CLOSE(\n"
498          "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(0.75)),\n"
499          "      static_cast<T>(" << r3/r3d << "L),\n"
500          "      tolerance);\n";
501       std::cout <<
502          "   BOOST_CHECK_CLOSE(\n"
503          "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(1.0f - 1.0f/64.0f)),\n"
504          "      static_cast<T>(" << r4/r4d << "L),\n"
505          "      tolerance);\n";
506       if(fabs(r5/r5d) < tools::max_value<float>())
507          std::cout <<
508             "   BOOST_CHECK_CLOSE(\n"
509             "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(6.5f)),\n"
510             "      static_cast<T>(" << r5/r5d << "L),\n"
511             "      tolerance);\n";
512       if(fabs(r6/r6d) < tools::max_value<float>())
513          std::cout <<
514             "   BOOST_CHECK_CLOSE(\n"
515             "      boost::math::tools::evaluate_rational(n" << i << "a, d" << i << "a, static_cast<T>(10247.25f)),\n"
516             "      static_cast<T>(" << r6/r6d << "L),\n"
517             "      tolerance);\n\n";
518    }
519 
520    return 0;
521 }
522 
523 
524 
525