Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:31

0001 //  (C) Copyright John Maddock 2007.
0002 //  Use, modification and distribution are subject to the
0003 //  Boost Software License, Version 1.0. (See accompanying file
0004 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 //
0006 //  This file is machine generated, do not edit by hand
0007 
0008 // Polynomial evaluation using Horners rule
0009 #ifndef BOOST_MATH_TOOLS_POLY_RAT_4_HPP
0010 #define BOOST_MATH_TOOLS_POLY_RAT_4_HPP
0011 
0012 namespace boost{ namespace math{ namespace tools{ namespace detail{
0013 
0014 template <class T, class U, class V>
0015 inline V evaluate_rational_c_imp(const T*, const U*, const V&, const std::integral_constant<int, 0>*) BOOST_MATH_NOEXCEPT(V)
0016 {
0017    return static_cast<V>(0);
0018 }
0019 
0020 template <class T, class U, class V>
0021 inline V evaluate_rational_c_imp(const T* a, const U* b, const V&, const std::integral_constant<int, 1>*) BOOST_MATH_NOEXCEPT(V)
0022 {
0023    return static_cast<V>(a[0]) / static_cast<V>(b[0]);
0024 }
0025 
0026 template <class T, class U, class V>
0027 inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 2>*) BOOST_MATH_NOEXCEPT(V)
0028 {
0029    if(x <= 1)
0030      return static_cast<V>((a[1] * x + a[0]) / (b[1] * x + b[0]));
0031    else
0032    {
0033       V z = 1 / x;
0034       return static_cast<V>((a[0] * z + a[1]) / (b[0] * z + b[1]));
0035    }
0036 }
0037 
0038 template <class T, class U, class V>
0039 inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 3>*) BOOST_MATH_NOEXCEPT(V)
0040 {
0041    if(x <= 1)
0042      return static_cast<V>(((a[2] * x + a[1]) * x + a[0]) / ((b[2] * x + b[1]) * x + b[0]));
0043    else
0044    {
0045       V z = 1 / x;
0046       return static_cast<V>(((a[0] * z + a[1]) * z + a[2]) / ((b[0] * z + b[1]) * z + b[2]));
0047    }
0048 }
0049 
0050 template <class T, class U, class V>
0051 inline V evaluate_rational_c_imp(const T* a, const U* b, const V& x, const std::integral_constant<int, 4>*) BOOST_MATH_NOEXCEPT(V)
0052 {
0053    if(x <= 1)
0054      return static_cast<V>((((a[3] * x + a[2]) * x + a[1]) * x + a[0]) / (((b[3] * x + b[2]) * x + b[1]) * x + b[0]));
0055    else
0056    {
0057       V z = 1 / x;
0058       return static_cast<V>((((a[0] * z + a[1]) * z + a[2]) * z + a[3]) / (((b[0] * z + b[1]) * z + b[2]) * z + b[3]));
0059    }
0060 }
0061 
0062 
0063 }}}} // namespaces
0064 
0065 #endif // include guard
0066