本文整理汇总了C++中interval::right方法的典型用法代码示例。如果您正苦于以下问题:C++ interval::right方法的具体用法?C++ interval::right怎么用?C++ interval::right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类interval
的用法示例。
在下文中一共展示了interval::right方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pow
interval pow(const interval& I, unsigned int n)
{
if (n == 0) {
return interval(1.0);
}
if (n == 1) {
return I;
}
if ((n % 2) == 0) { // n is even?
if (I.left() >= 0) { // I is positive?
double l = round_down(std::pow(I.left(),n));
double r = round_up(std::pow(I.right(),n));
return interval(l,r);
} else {
if (I.right() <= 0) { // I is negative?
double l = round_down(std::pow(I.right(),n));
double r = round_up(std::pow(I.left(),n));
return interval(l,r);
} else { // I straddles 0
double rl = round_up(std::pow(I.right(),n));
double rr = round_up(std::pow(I.left(),n));
return interval(0,max(rl,rr));
}
}
}
// n is odd
double l = round_down(std::pow(I.left(),n));
double r = round_up(std::pow(I.right(),n));
return interval(l,r);
}
示例2: split_box
// Split a 2D box into four subboxes by splitting each dimension
// into two equal subparts
void split_box(const interval &x, const interval &y, interval &xl, interval &xr,
interval &yl, interval &yr) {
double xm = x.mid();
double ym = y.mid();
xl = interval(x.left(), xm);
xr = interval(xm, x.right());
yl = interval(y.left(), ym);
yr = interval(ym, y.right());
}
示例3: interval
interval operator-(const interval& I1, const interval& I2)
{
round_downward();
double l = I1.left() - I2.right();
round_upward();
double r = I1.right() - I2.left();
round_nearest();
return interval(l,r);
}
示例4: MPI_Send_Interval
void MPI_Send_Interval(const interval & x, const interval & y, double threshold, double min_ub) {
double envoie_inter_thres_min[6] = {x.left(),x.right(),y.left(),y.right(),threshold,min_ub};
MPI_Send(&choice_fun,50,MPI_CHAR,cpt,0,MPI_COMM_WORLD);
MPI_Send(&envoie_inter_thres_min,6,MPI_DOUBLE,cpt,0,MPI_COMM_WORLD);
}