mirror of
https://github.com/boostorg/math.git
synced 2026-01-26 18:52:10 +00:00
Fix binomial_coefficient forwarding policy
This addresses an issue where unintended double-promotion could occur. See #398.
This commit is contained in:
@@ -63,7 +63,13 @@ T binomial_coefficient(unsigned n, unsigned k, const Policy& pol)
|
||||
template <>
|
||||
inline float binomial_coefficient<float, policies::policy<> >(unsigned n, unsigned k, const policies::policy<>& pol)
|
||||
{
|
||||
return policies::checked_narrowing_cast<float, policies::policy<> >(binomial_coefficient<double>(n, k, pol), "boost::math::binomial_coefficient<%1%>(unsigned,unsigned)");
|
||||
typedef policies::normalise<
|
||||
policies::policy<>,
|
||||
policies::promote_float<true>,
|
||||
policies::promote_double<false>,
|
||||
policies::discrete_quantile<>,
|
||||
policies::assert_undefined<> >::type forwarding_policy;
|
||||
return policies::checked_narrowing_cast<float, forwarding_policy>(binomial_coefficient<double>(n, k, forwarding_policy()), "boost::math::binomial_coefficient<%1%>(unsigned,unsigned)");
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
Reference in New Issue
Block a user