Overlapping box with infinite edge coordinate

I am trying to understand how window overlap works with infinity

Why the following example does not work. It works fine except when I try to enter two infinite values.

This example should return true.

SELECT box '((1,1),(infinity, 1))' && box '((2, 1),(infinity, 1))' AS overlap;
overlap 
---------
f

The two examples below work

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 that I am doing wrong or that I do not understand?

0
source share
1 answer

I asked in postgresql buglist:

Tom Lane gave me this answer:

The test for this includes

FPge(box1->high.x, box2->high.x)

where FPge is defined as

#define FPge(A,B)    ((B) - (A) <= EPSILON)

When both high.x values ​​are infinite, you have infinity minus infinity that gives NaN in IEEE arithmetic, so the comparison with epsilon out false occurs.

, , , , . , , , , .

0

All Articles