I try to understand how does overlapping box with infinity works
Why does the following exemple doesn’t work. It works fine except when i try to introduce two infinite values.
This exemple should return true.
SELECT box '((1,1),(infinity, 1))' && box '((2, 1),(infinity, 1))' AS overlap;
overlap
---------
f
The two exemples below works
SELECT box '((1,1),(4, 1))' && box '((2, 1),(infinity, 1))' AS overlap;
overlap
---------
t
SELECT box '((1,1),(4, 1))' && box '((2, 1),(5, 1))' AS overlap;
overlap
---------
t
So my question is : Is there something i’m doing wrong or that i don’t understand?
I asked on the postgresql buglist:
Tom lane gave me this answer :
The test for this involves
where FPge is defined as
When both high.x values are infinity, you have infinity minus infinity,
which yields NaN in IEEE arithmetic, so the comparison to epsilon comes
out false.
In general I don’t think we promise that geometric operations involving
infinite endpoints will behave sanely. There are probably a boatload
of corner cases besides this one that’d need to be fixed before we
could consider that a supported case.