else if(z < 15)
{
typedef typename policies::precision<T, Policy>::type precision_type;
- typedef typename mpl::if_<
- mpl::and_<
- mpl::less_equal<precision_type, mpl::int_<64> >,
- mpl::greater<precision_type, mpl::int_<0> >
- >,
- mpl::int_<64>,
- typename mpl::if_<
- mpl::and_<
- mpl::less_equal<precision_type, mpl::int_<113> >,
- mpl::greater<precision_type, mpl::int_<0> >
- >,
- mpl::int_<113>, mpl::int_<0> >::type
- >::type tag_type;
+ typedef boost::integral_constant<int,
+ precision_type::value <= 0 ? 0 :
+ precision_type::value <= 64 ? 64 :
+ precision_type::value <= 113 ? 113 : 0
+ > tag_type;
+
result = lgamma_small_imp<T>(z, T(z - 1), T(z - 2), tag_type(), pol, l);
}
else if((z >= 3) && (z < 100) && (std::numeric_limits<T>::max_exponent >= 1024))
typedef typename policies::precision<T,Policy>::type precision_type;
- typedef typename mpl::if_<
- mpl::or_<
- mpl::less_equal<precision_type, mpl::int_<0> >,
- mpl::greater<precision_type, mpl::int_<113> >
- >,
- typename mpl::if_<
- mpl::and_<is_same<Lanczos, lanczos::lanczos24m113>, mpl::greater<precision_type, mpl::int_<0> > >,
- mpl::int_<113>,
- mpl::int_<0>
- >::type,
- typename mpl::if_<
- mpl::less_equal<precision_type, mpl::int_<64> >,
- mpl::int_<64>, mpl::int_<113> >::type
- >::type tag_type;
+ typedef boost::integral_constant<int,
+ precision_type::value <= 0 ? 0 :
+ precision_type::value <= 64 ? 64 :
+ precision_type::value <= 113 ? 113 : 0
+ > tag_type;
T result;
if(dz < 0)
// We have to treat a < 1 as a special case because our Lanczos
// approximations are optimised against the factorials with a > 1,
// and for high precision types especially (128-bit reals for example)
- // very small values of a can give rather eroneous results for gamma
+ // very small values of a can give rather erroneous results for gamma
// unless we do this:
//
// TODO: is this still required? Lanczos approx should be better now?
// way from a in value then we can reliably use methods 2 and 4
// below in logarithmic form and go straight to the result.
// Otherwise we let the regularized gamma take the strain
- // (the result is unlikely to unerflow in the central region anyway)
+ // (the result is unlikely to underflow in the central region anyway)
// and combine with lgamma in the hopes that we get a finite result.
//
if(invert && (a * 4 < x))
// series sum based on what we'll end up subtracting it from
// at the end.
// Have to be careful though that this optimization doesn't
- // lead to spurious numberic overflow. Note that the
+ // lead to spurious numeric overflow. Note that the
// scary/expensive overflow checks below are more often
// than not bypassed in practice for "sensible" input
// values:
//
typedef typename policies::precision<T, Policy>::type precision_type;
- typedef typename mpl::if_<
- mpl::or_<mpl::equal_to<precision_type, mpl::int_<0> >,
- mpl::greater<precision_type, mpl::int_<113> > >,
- mpl::int_<0>,
- typename mpl::if_<
- mpl::less_equal<precision_type, mpl::int_<53> >,
- mpl::int_<53>,
- typename mpl::if_<
- mpl::less_equal<precision_type, mpl::int_<64> >,
- mpl::int_<64>,
- mpl::int_<113>
- >::type
- >::type
- >::type tag_type;
+ typedef boost::integral_constant<int,
+ precision_type::value <= 0 ? 0 :
+ precision_type::value <= 53 ? 53 :
+ precision_type::value <= 64 ? 64 :
+ precision_type::value <= 113 ? 113 : 0
+ > tag_type;
result = igamma_temme_large(a, x, pol, static_cast<tag_type const*>(0));
if(x >= a)
if((z <= 0) || (z + delta <= 0))
{
- // This isn't very sofisticated, or accurate, but it does work:
+ // This isn't very sophisticated, or accurate, but it does work:
return boost::math::tgamma(z, pol) / boost::math::tgamma(z + delta, pol);
}
template <class T, class Policy>
inline typename tools::promote_args<T>::type
- tgamma(T z, const Policy& /* pol */, const mpl::true_)
+ tgamma(T z, const Policy& /* pol */, const boost::true_type)
{
BOOST_FPU_EXCEPTION_GUARD
typedef typename tools::promote_args<T>::type result_type;
{
typedef typename policies::precision<T, Policy>::type precision_type;
- typedef typename mpl::if_<
- mpl::or_<mpl::equal_to<precision_type, mpl::int_<0> >,
- mpl::greater<precision_type, mpl::int_<113> > >,
- mpl::int_<0>,
- typename mpl::if_<
- mpl::less_equal<precision_type, mpl::int_<53> >,
- mpl::int_<53>,
- typename mpl::if_<
- mpl::less_equal<precision_type, mpl::int_<64> >,
- mpl::int_<64>,
- mpl::int_<113>
- >::type
- >::type
- >::type tag_type;
+ typedef boost::integral_constant<int,
+ precision_type::value <= 0 ? 0 :
+ precision_type::value <= 53 ? 53 :
+ precision_type::value <= 64 ? 64 :
+ precision_type::value <= 113 ? 113 : 0
+ > tag_type;
do_init(tag_type());
}
template <int N>
- static void do_init(const mpl::int_<N>&)
+ static void do_init(const boost::integral_constant<int, N>&)
{
// If std::numeric_limits<T>::digits is zero, we must not call
- // our inituialization code here as the precision presumably
+ // our initialization code here as the precision presumably
// varies at runtime, and will not have been set yet. Plus the
// code requiring initialization isn't called when digits == 0.
if(std::numeric_limits<T>::digits)
boost::math::gamma_p(static_cast<T>(400), static_cast<T>(400), Policy());
}
}
- static void do_init(const mpl::int_<53>&){}
+ static void do_init(const boost::integral_constant<int, 53>&){}
void force_instantiate()const{}
};
static const init initializer;
init()
{
typedef typename policies::precision<T, Policy>::type precision_type;
- typedef typename mpl::if_<
- mpl::and_<
- mpl::less_equal<precision_type, mpl::int_<64> >,
- mpl::greater<precision_type, mpl::int_<0> >
- >,
- mpl::int_<64>,
- typename mpl::if_<
- mpl::and_<
- mpl::less_equal<precision_type, mpl::int_<113> >,
- mpl::greater<precision_type, mpl::int_<0> >
- >,
- mpl::int_<113>, mpl::int_<0> >::type
- >::type tag_type;
+ typedef boost::integral_constant<int,
+ precision_type::value <= 0 ? 0 :
+ precision_type::value <= 64 ? 64 :
+ precision_type::value <= 113 ? 113 : 0
+ > tag_type;
+
do_init(tag_type());
}
- static void do_init(const mpl::int_<64>&)
+ static void do_init(const boost::integral_constant<int, 64>&)
{
boost::math::lgamma(static_cast<T>(2.5), Policy());
boost::math::lgamma(static_cast<T>(1.25), Policy());
boost::math::lgamma(static_cast<T>(1.75), Policy());
}
- static void do_init(const mpl::int_<113>&)
+ static void do_init(const boost::integral_constant<int, 113>&)
{
boost::math::lgamma(static_cast<T>(2.5), Policy());
boost::math::lgamma(static_cast<T>(1.25), Policy());
boost::math::lgamma(static_cast<T>(1.5), Policy());
boost::math::lgamma(static_cast<T>(1.75), Policy());
}
- static void do_init(const mpl::int_<0>&)
+ static void do_init(const boost::integral_constant<int, 0>&)
{
}
void force_instantiate()const{}
template <class T1, class T2, class Policy>
inline typename tools::promote_args<T1, T2>::type
- tgamma(T1 a, T2 z, const Policy&, const mpl::false_)
+ tgamma(T1 a, T2 z, const Policy&, const boost::false_type)
{
BOOST_FPU_EXCEPTION_GUARD
typedef typename tools::promote_args<T1, T2>::type result_type;
template <class T1, class T2>
inline typename tools::promote_args<T1, T2>::type
- tgamma(T1 a, T2 z, const mpl::false_ tag)
+ tgamma(T1 a, T2 z, const boost::false_type& tag)
{
return tgamma(a, z, policies::policy<>(), tag);
}
inline typename tools::promote_args<T1, T2>::type
tgamma(T1 a, T2 z, const Policy& pol)
{
- return detail::tgamma(a, z, pol, mpl::false_());
+ return detail::tgamma(a, z, pol, boost::false_type());
}
//
// Full lower incomplete gamma: