Hello, Patrick. At Thu, 12 Mar 2020 10:16:15 -0700, Patrick Dowler <pdowler.cadc@xxxxxxxxx> wrote in > I am using polygon datatype with some very small values and discovered that > the overlaps operator appears to break down and give false positives for > values smaller than ~1e-6. I have tested this on 9.5 (.3 and .16) and 10.10. For usability, geometric arithmetics is performed having 1.0E-6 of tolerance. For example equalness between two floating point values is defined as: #define EPSILON 1.0E-06 #define FPeq(A, B) (fabs((A) - (B)) <= EPSILON) Point-same-as is defined using the comparison, so the following comparison gives true. =# select '(1.5E-06, 0)'::point ~= '(1.0E-06, 0.5E-06)'::point; ?column? ---------- t All comparisons are performed taking that degree of tolerance. By a rough calculation, that tolerance in long-lat coordinate is corresnponding to that of about 40 meters on the ground. > To reproduce (these examples only differ in the x-axis exponents) and > should be false but the first one is t(rue) > > select '((3.0e-07,-2),(9.0e-07,-2),(9.0e-07,1),(3.0e-07,1))'::polygon > && > '((2.0e-07,-0.1),(2.0e-07,0.1),(2.01e-07,0.1),(2.01e-07,-0.1))'::polygon; > > select '((3.0e-06,-2),(9.0e-06,-2),(9.0e-06,1),(3.0e-06,1))'::polygon > && > '((2.0e-06,-0.1),(2.0e-06,0.1),(2.01e-06,0.1),(2.01e-06,-0.1))'::polygon; > > Maybe suggests some single-precision floating point use in the > calculations... regards. -- Kyotaro Horiguchi NTT Open Source Software Center