![]()  | 
![]() ![]() ![]() ![]()  | 
![]()  | 
Internal Floating-point Promotion PoliciesBoost , Math Toolkit 2.5.0 , Policy Reference
  
  
   | 
||||||||||||
| 
                 Политика  | 
                 значение  | 
|---|---|
<  | 
Указывает на то, что<  | 
<  | 
Указывает, следует ли<  | 
Предположим, что мы хотим, чтобы<tgamma>оценивалось без внутреннего продвижения<long
       double>, тогда мы могли бы использовать:
#include <boost/math/special_functions/gamma.hpp> using namespace boost::math::policies; using boost::math::tgamma; // Define a new policy *not* internally promoting RealType to double: typedef policy< promote_double<false> > my_policy; // Call the function, applying the new policy: double t1 = tgamma(some_value, my_policy()); // Alternatively we could use helper function make_policy, // and concisely define everything at the call site: double t2 = tgamma(some_value, make_policy(promote_double<false>()));
В качестве альтернативы, предположим, что мы хотим, чтобы распределение выполняло вычисления без продвижения<float>к<double>, тогда мы могли бы использовать:
#include <boost/math/distributions/normal.hpp> using boost::math::normal_distribution; using namespace boost::math::policies; // Define a policy: typedef policy< promote_float<false> > my_policy; // Define the new normal distribution using my_policy: typedef normal_distribution<float, my_policy> my_norm; // Get a quantile: float q = quantile(my_norm(), 0.05f);
Статья Internal Floating-point Promotion Policies раздела Math Toolkit 2.5.0 Policy Reference может быть полезна для разработчиков на c++ и boost.
:: Главная :: Policy Reference ::
реклама  |