Search Postgresql Archives

polygon && polygon and precision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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...

--
Patrick Dowler
Canadian Astronomy Data Centre
Victoria, BC, Canada

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux