summaryrefslogtreecommitdiff
path: root/boost/math/tools/big_constant.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/math/tools/big_constant.hpp')
-rw-r--r--boost/math/tools/big_constant.hpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/boost/math/tools/big_constant.hpp b/boost/math/tools/big_constant.hpp
index 45f13ceef9..119063164a 100644
--- a/boost/math/tools/big_constant.hpp
+++ b/boost/math/tools/big_constant.hpp
@@ -11,15 +11,17 @@
#include <boost/lexical_cast.hpp>
#include <boost/type_traits/is_convertible.hpp>
-namespace boost{ namespace math{ namespace tools{
+namespace boost{ namespace math{
+
+namespace tools{
template <class T>
-inline T make_big_value(long double v, const char*, mpl::true_ const&, mpl::false_ const&)
+inline BOOST_CONSTEXPR_OR_CONST T make_big_value(long double v, const char*, mpl::true_ const&, mpl::false_ const&)
{
return static_cast<T>(v);
}
template <class T>
-inline T make_big_value(long double v, const char*, mpl::true_ const&, mpl::true_ const&)
+inline BOOST_CONSTEXPR_OR_CONST T make_big_value(long double v, const char*, mpl::true_ const&, mpl::true_ const&)
{
return static_cast<T>(v);
}
@@ -29,7 +31,7 @@ inline T make_big_value(long double, const char* s, mpl::false_ const&, mpl::fal
return boost::lexical_cast<T>(s);
}
template <class T>
-inline const char* make_big_value(long double, const char* s, mpl::false_ const&, mpl::true_ const&)
+inline BOOST_CONSTEXPR const char* make_big_value(long double, const char* s, mpl::false_ const&, mpl::true_ const&)
{
return s;
}
@@ -38,7 +40,15 @@ inline const char* make_big_value(long double, const char* s, mpl::false_ const&
// For constants which might fit in a long double (if it's big enough):
//
#define BOOST_MATH_BIG_CONSTANT(T, D, x)\
- boost::math::tools::make_big_value<T>(BOOST_JOIN(x, L), BOOST_STRINGIZE(x), mpl::bool_<D <= std::numeric_limits<long double>::digits>(), boost::is_convertible<const char*, T>())
+ boost::math::tools::make_big_value<T>(\
+ BOOST_JOIN(x, L), \
+ BOOST_STRINGIZE(x), \
+ mpl::bool_< (is_convertible<long double, T>::value) && \
+ ((D <= std::numeric_limits<long double>::digits) \
+ || is_floating_point<T>::value \
+ || (std::numeric_limits<T>::is_specialized && \
+ (std::numeric_limits<T>::digits10 <= std::numeric_limits<long double>::digits10))) >(), \
+ boost::is_convertible<const char*, T>())
//
// For constants too huge for any conceivable long double (and which generate compiler errors if we try and declare them as such):
//