Is this a bug or I should call a canonicalize method?
Brought to you by:
goualard
I compiled this code with Clang 6.0.1 on Mac.
#include <gaol/gaol.h>
#include <iostream>
int main() {
using G = gaol::interval;
G a(1,10);
G b(2,1);
// Next line outputs [3,11], but b is an empty interval.
// Am I supposed to call a canonicalize method? (don't know the name)
std::cout << (a+b) << "\n";
}
Hello Nima,
Even though it is not explicitly stated in the documentation, you are not allowed to construct an empty interval by using a left bound that is greater than the right bound. You should use interval::emptyset instead.
The same holds for the possibility of defining an interval of the form [-oo, -oo] even though it might lead to incoherent behavior later on (that point is described in the manual on page 16, though).
What were you trying to achieve by defining 'b' that way?