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)
6 // This file is machine generated, do not edit by hand
8 // Unrolled polynomial evaluation using second order Horners rule
9 #ifndef BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
10 #define BOOST_MATH_TOOLS_POLY_EVAL_14_HPP
12 namespace boost{ namespace math{ namespace tools{ namespace detail{
14 template <class T, class V>
15 inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*)
17 return static_cast<V>(0);
20 template <class T, class V>
21 inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*)
23 return static_cast<V>(a[0]);
26 template <class T, class V>
27 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*)
29 return static_cast<V>(a[1] * x + a[0]);
32 template <class T, class V>
33 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*)
35 return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
38 template <class T, class V>
39 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*)
41 return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
44 template <class T, class V>
45 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*)
49 t[0] = static_cast<V>(a[4] * x2 + a[2]);
50 t[1] = static_cast<V>(a[3] * x2 + a[1]);
52 t[0] += static_cast<V>(a[0]);
57 template <class T, class V>
58 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<6>*)
62 t[0] = a[5] * x2 + a[3];
63 t[1] = a[4] * x2 + a[2];
66 t[0] += static_cast<V>(a[1]);
67 t[1] += static_cast<V>(a[0]);
72 template <class T, class V>
73 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<7>*)
77 t[0] = static_cast<V>(a[6] * x2 + a[4]);
78 t[1] = static_cast<V>(a[5] * x2 + a[3]);
81 t[0] += static_cast<V>(a[2]);
82 t[1] += static_cast<V>(a[1]);
84 t[0] += static_cast<V>(a[0]);
89 template <class T, class V>
90 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<8>*)
94 t[0] = a[7] * x2 + a[5];
95 t[1] = a[6] * x2 + a[4];
98 t[0] += static_cast<V>(a[3]);
99 t[1] += static_cast<V>(a[2]);
102 t[0] += static_cast<V>(a[1]);
103 t[1] += static_cast<V>(a[0]);
108 template <class T, class V>
109 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<9>*)
113 t[0] = static_cast<V>(a[8] * x2 + a[6]);
114 t[1] = static_cast<V>(a[7] * x2 + a[5]);
117 t[0] += static_cast<V>(a[4]);
118 t[1] += static_cast<V>(a[3]);
121 t[0] += static_cast<V>(a[2]);
122 t[1] += static_cast<V>(a[1]);
124 t[0] += static_cast<V>(a[0]);
129 template <class T, class V>
130 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<10>*)
134 t[0] = a[9] * x2 + a[7];
135 t[1] = a[8] * x2 + a[6];
138 t[0] += static_cast<V>(a[5]);
139 t[1] += static_cast<V>(a[4]);
142 t[0] += static_cast<V>(a[3]);
143 t[1] += static_cast<V>(a[2]);
146 t[0] += static_cast<V>(a[1]);
147 t[1] += static_cast<V>(a[0]);
152 template <class T, class V>
153 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<11>*)
157 t[0] = static_cast<V>(a[10] * x2 + a[8]);
158 t[1] = static_cast<V>(a[9] * x2 + a[7]);
161 t[0] += static_cast<V>(a[6]);
162 t[1] += static_cast<V>(a[5]);
165 t[0] += static_cast<V>(a[4]);
166 t[1] += static_cast<V>(a[3]);
169 t[0] += static_cast<V>(a[2]);
170 t[1] += static_cast<V>(a[1]);
172 t[0] += static_cast<V>(a[0]);
177 template <class T, class V>
178 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<12>*)
182 t[0] = a[11] * x2 + a[9];
183 t[1] = a[10] * x2 + a[8];
186 t[0] += static_cast<V>(a[7]);
187 t[1] += static_cast<V>(a[6]);
190 t[0] += static_cast<V>(a[5]);
191 t[1] += static_cast<V>(a[4]);
194 t[0] += static_cast<V>(a[3]);
195 t[1] += static_cast<V>(a[2]);
198 t[0] += static_cast<V>(a[1]);
199 t[1] += static_cast<V>(a[0]);
204 template <class T, class V>
205 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<13>*)
209 t[0] = static_cast<V>(a[12] * x2 + a[10]);
210 t[1] = static_cast<V>(a[11] * x2 + a[9]);
213 t[0] += static_cast<V>(a[8]);
214 t[1] += static_cast<V>(a[7]);
217 t[0] += static_cast<V>(a[6]);
218 t[1] += static_cast<V>(a[5]);
221 t[0] += static_cast<V>(a[4]);
222 t[1] += static_cast<V>(a[3]);
225 t[0] += static_cast<V>(a[2]);
226 t[1] += static_cast<V>(a[1]);
228 t[0] += static_cast<V>(a[0]);
233 template <class T, class V>
234 inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<14>*)
238 t[0] = a[13] * x2 + a[11];
239 t[1] = a[12] * x2 + a[10];
242 t[0] += static_cast<V>(a[9]);
243 t[1] += static_cast<V>(a[8]);
246 t[0] += static_cast<V>(a[7]);
247 t[1] += static_cast<V>(a[6]);
250 t[0] += static_cast<V>(a[5]);
251 t[1] += static_cast<V>(a[4]);
254 t[0] += static_cast<V>(a[3]);
255 t[1] += static_cast<V>(a[2]);
258 t[0] += static_cast<V>(a[1]);
259 t[1] += static_cast<V>(a[0]);
267 #endif // include guard