comparison DEPENDENCIES/generic/include/boost/math/special_functions/trunc.hpp @ 101:c530137014c0

Update Boost headers (1.58.0)
author Chris Cannam
date Mon, 07 Sep 2015 11:12:49 +0100
parents 2665513ce2d3
children
comparison
equal deleted inserted replaced
100:793467b5e61c 101:c530137014c0
8 8
9 #ifdef _MSC_VER 9 #ifdef _MSC_VER
10 #pragma once 10 #pragma once
11 #endif 11 #endif
12 12
13 #include <boost/math/special_functions/math_fwd.hpp>
13 #include <boost/math/tools/config.hpp> 14 #include <boost/math/tools/config.hpp>
14 #include <boost/math/policies/error_handling.hpp> 15 #include <boost/math/policies/error_handling.hpp>
15 #include <boost/math/special_functions/fpclassify.hpp> 16 #include <boost/math/special_functions/fpclassify.hpp>
16 17
17 namespace boost{ namespace math{ 18 namespace boost{ namespace math{ namespace detail{
18 19
19 template <class T, class Policy> 20 template <class T, class Policy>
20 inline typename tools::promote_args<T>::type trunc(const T& v, const Policy& pol) 21 inline typename tools::promote_args<T>::type trunc(const T& v, const Policy& pol, const mpl::false_&)
21 { 22 {
22 BOOST_MATH_STD_USING 23 BOOST_MATH_STD_USING
23 typedef typename tools::promote_args<T>::type result_type; 24 typedef typename tools::promote_args<T>::type result_type;
24 if(!(boost::math::isfinite)(v)) 25 if(!(boost::math::isfinite)(v))
25 return policies::raise_rounding_error("boost::math::trunc<%1%>(%1%)", 0, static_cast<result_type>(v), static_cast<result_type>(v), pol); 26 return policies::raise_rounding_error("boost::math::trunc<%1%>(%1%)", 0, static_cast<result_type>(v), static_cast<result_type>(v), pol);
26 return (v >= 0) ? static_cast<result_type>(floor(v)) : static_cast<result_type>(ceil(v)); 27 return (v >= 0) ? static_cast<result_type>(floor(v)) : static_cast<result_type>(ceil(v));
28 }
29
30 template <class T, class Policy>
31 inline typename tools::promote_args<T>::type trunc(const T& v, const Policy&, const mpl::true_&)
32 {
33 return v;
34 }
35
36 }
37
38 template <class T, class Policy>
39 inline typename tools::promote_args<T>::type trunc(const T& v, const Policy& pol)
40 {
41 return detail::trunc(v, pol, mpl::bool_<detail::is_integer_for_rounding<T>::value>());
27 } 42 }
28 template <class T> 43 template <class T>
29 inline typename tools::promote_args<T>::type trunc(const T& v) 44 inline typename tools::promote_args<T>::type trunc(const T& v)
30 { 45 {
31 return trunc(v, policies::policy<>()); 46 return trunc(v, policies::policy<>());