本文整理汇总了C++中typenamepolicies::rounding::div_down方法的典型用法代码示例。如果您正苦于以下问题:C++ rounding::div_down方法的具体用法?C++ rounding::div_down怎么用?C++ rounding::div_down使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenamepolicies::rounding
的用法示例。
在下文中一共展示了rounding::div_down方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: I
template<class T, class Policies> inline
interval<T, Policies> div_zero_part2(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
// assert(::boost::numeric::interval_lib::user::is_neg(y.lower()) && ::boost::numeric::interval_lib::user::is_pos(y.upper()) && (div_zero_part1(x, y, b), b));
typename Policies::rounding rnd;
typedef interval<T, Policies> I;
typedef typename Policies::checking checking;
if (::boost::numeric::interval_lib::user::is_neg(x.upper()))
return I(rnd.div_down(x.upper(), y.lower()), checking::pos_inf(), true);
else
return I(rnd.div_down(x.lower(), y.upper()), checking::pos_inf(), true);
}
示例2: I
template<class T, class Policies> inline
interval<T, Policies> div_zero_part2(const interval<T, Policies>& x,
const interval<T, Policies>& y)
{
// assert(y.lower() < 0 && y.upper() > 0 && (div_zero_part1(x, y, b), b));
typename Policies::rounding rnd;
typedef interval<T, Policies> I;
typedef typename I::checking checking;
const T& inf = checking::inf();
if (is_neg(x.upper()))
return I(rnd.div_down(x.upper(), y.lower()), inf, true);
else
return I(rnd.div_down(x.lower(), y.upper()), inf, true);
}
示例3: div
template<class I> inline
I div(const typename I::base_type& x, const typename I::base_type& y)
{
typedef typename I::traits_type Policies;
if (detail::test_input<typename I::base_type, Policies>(x, y) || user::is_zero(y))
return I::empty();
typename Policies::rounding rnd;
return I(rnd.div_down(x, y), rnd.div_up(x, y), true);
}
示例4: fmod
template<class T, class Policies> inline
interval<T, Policies> fmod(const interval<T, Policies>& x, const T& y)
{
if (interval_lib::detail::test_input(x, y))
return interval<T, Policies>::empty();
typename Policies::rounding rnd;
typedef typename interval_lib::unprotect<interval<T, Policies> >::type I;
T n = rnd.int_down(rnd.div_down(x.lower(), y));
return (const I&)x - n * I(y);
}
示例5: empty
template<class T, class Policies> inline
interval<T, Policies> multiplicative_inverse(const interval<T, Policies>& x)
{
typedef interval<T, Policies> I;
if (detail::test_input(x))
return I::empty();
T one = static_cast<T>(1);
typename Policies::rounding rnd;
if (in_zero(x)) {
typedef typename Policies::checking checking;
if (!detail::is_zero(x.lower()))
if (!detail::is_zero(x.upper()))
return I::whole();
else
return I(-checking::inf(), rnd.div_up(one, x.lower()), true);
else
if (!detail::is_zero(x.upper()))
return I(rnd.div_down(one, x.upper()), checking::inf(), true);
else
return I::empty();
} else
return I(rnd.div_down(one, x.upper()), rnd.div_up(one, x.lower()), true);
}