/usr/include/boost/math/tools
NameSizeModeActions
detail/-0755rm
atomic.hpp32550644editdlrm
big_constant.hpp34120644editdlrm
bivariate_statistics.hpp28580644editdlrm
complex.hpp17440644editdlrm
condition_numbers.hpp34980644editdlrm
config.hpp145790644editdlrm
convert_from_string.hpp16560644editdlrm
cxx03_warn.hpp51280644editdlrm
fraction.hpp87330644editdlrm
minima.hpp43190644editdlrm
norms.hpp164250644editdlrm
numerical_differentiation.hpp5330644editdlrm
polynomial.hpp219460644editdlrm
polynomial_gcd.hpp60440644editdlrm
precision.hpp141330644editdlrm
promotion.hpp84340644editdlrm
rational.hpp138090644editdlrm
real_cast.hpp7440644editdlrm
recurrence.hpp129010644editdlrm
roots.hpp343730644editdlrm
series.hpp64450644editdlrm
signal_statistics.hpp120610644editdlrm
stats.hpp20560644editdlrm
test_value.hpp55230644editdlrm
toms748_solve.hpp183290644editdlrm
traits.hpp30010644editdlrm
tuple.hpp20400644editdlrm
univariate_statistics.hpp124650644editdlrm
user.hpp26360644editdlrm
workaround.hpp10670644editdlrm
Edit: /usr/include/boost/math/tools/promotion.hpp (8434B)
// boost\math\tools\promotion.hpp // Copyright John Maddock 2006. // Copyright Paul A. Bristow 2006. // 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) // Promote arguments functions to allow math functions to have arguments // provided as integer OR real (floating-point, built-in or UDT) // (called ArithmeticType in functions that use promotion) // that help to reduce the risk of creating multiple instantiations. // Allows creation of an inline wrapper that forwards to a foo(RT, RT) function, // so you never get to instantiate any mixed foo(RT, IT) functions. #ifndef BOOST_MATH_PROMOTION_HPP #define BOOST_MATH_PROMOTION_HPP #ifdef _MSC_VER #pragma once #endif // Boost type traits: #include #include // for boost::is_floating_point; #include // for boost::is_integral #include // for boost::is_convertible #include // for boost::is_same #include // for boost::remove_cv // Boost Template meta programming: #include // for boost::mpl::if_c. #include // for boost::mpl::if_c. #include // for boost::mpl::if_c. #include // for boost::mpl::if_c. #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS #include #endif namespace boost { namespace math { namespace tools { // If either T1 or T2 is an integer type, // pretend it was a double (for the purposes of further analysis). // Then pick the wider of the two floating-point types // as the actual signature to forward to. // For example: // foo(int, short) -> double foo(double, double); // foo(int, float) -> double foo(double, double); // Note: NOT float foo(float, float) // foo(int, double) -> foo(double, double); // foo(double, float) -> double foo(double, double); // foo(double, float) -> double foo(double, double); // foo(any-int-or-float-type, long double) -> foo(long double, long double); // but ONLY float foo(float, float) is unchanged. // So the only way to get an entirely float version is to call foo(1.F, 2.F), // But since most (all?) the math functions convert to double internally, // probably there would not be the hoped-for gain by using float here. // This follows the C-compatible conversion rules of pow, etc // where pow(int, float) is converted to pow(double, double). template struct promote_arg { // If T is integral type, then promote to double. typedef typename mpl::if_, double, T>::type type; }; // These full specialisations reduce mpl::if_ usage and speed up // compilation: template <> struct promote_arg { typedef float type; }; template <> struct promote_arg{ typedef double type; }; template <> struct promote_arg { typedef long double type; }; template <> struct promote_arg { typedef double type; }; template struct promote_args_2 { // Promote, if necessary, & pick the wider of the two floating-point types. // for both parameter types, if integral promote to double. typedef typename promote_arg::type T1P; // T1 perhaps promoted. typedef typename promote_arg::type T2P; // T2 perhaps promoted. typedef typename mpl::if_c< is_floating_point::value && is_floating_point::value, // both T1P and T2P are floating-point? #ifdef BOOST_MATH_USE_FLOAT128 typename mpl::if_c::value || is_same<__float128, T2P>::value, // either long double? __float128, #endif typename mpl::if_c::value || is_same::value, // either long double? long double, // then result type is long double. typename mpl::if_c::value || is_same::value, // either double? double, // result type is double. float // else result type is float. >::type #ifdef BOOST_MATH_USE_FLOAT128 >::type #endif >::type, // else one or the other is a user-defined type: typename mpl::if_c::value && ::boost::is_convertible::value, T2P, T1P>::type>::type type; }; // promote_arg2 // These full specialisations reduce mpl::if_ usage and speed up // compilation: template <> struct promote_args_2 { typedef float type; }; template <> struct promote_args_2{ typedef double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef long double type; }; template <> struct promote_args_2 { typedef long double type; }; template struct promote_args { typedef typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename remove_cv::type >::type >::type >::type >::type >::type type; #ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS // // Guard against use of long double if it's not supported: // BOOST_STATIC_ASSERT_MSG((0 == ::boost::is_same::value), "Sorry, but this platform does not have sufficient long double support for the special functions to be reliably implemented."); #endif }; // // This struct is the same as above, but has no static assert on long double usage, // it should be used only on functions that can be implemented for long double // even when std lib support is missing or broken for that type. // template struct promote_args_permissive { typedef typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename promote_args_2< typename remove_cv::type, typename remove_cv::type >::type >::type >::type >::type >::type type; }; } // namespace tools } // namespace math } // namespace boost #endif // BOOST_MATH_PROMOTION_HPP