Add checks in the conversion to interval.

I am more or less asserting that x belongs to to_interval(x).
This commit is contained in:
Marc Glisse 2019-01-22 18:27:36 +01:00
parent 9f42c9380d
commit 811ab8ac43
1 changed files with 6 additions and 2 deletions

View File

@ -210,10 +210,14 @@ struct RET_boost_mp_base
double s = i;
double inf = std::numeric_limits<double>::infinity();
int cmp = x.compare(i);
if (cmp > 0)
if (cmp > 0) {
s = nextafter(s, +inf);
else if (cmp < 0)
CGAL_assertion(x.compare(s) < 0);
}
else if (cmp < 0) {
i = nextafter(i, -inf);
CGAL_assertion(x.compare(i) > 0);
}
return std::pair<double, double> (i, s);
}
};