<div dir="ltr">Hi,<div><br></div><div>Can you build it with -fexcess-precision=standard? If it helps, we need to add it to the 32-bit configure.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 29, 2021 at 6:14 PM Sandro Santilli <<a href="mailto:strk@kbt.io">strk@kbt.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Reguarding <a href="https://trac.osgeo.org/postgis/ticket/5004" rel="noreferrer" target="_blank">https://trac.osgeo.org/postgis/ticket/5004</a><br>
<br>
We have an liblwgeom function returning the "closest segment"<br>
to a given point. One of our test uses a query point which<br>
is on the continuation of the first segment of an L-shaped<br>
geometry:<br>
<br>
^<br>
|<br>
|<br>
|<br>
|<br>
---------' . Query point<br>
<br>
The test is expecting the first segment to be returned (seg 0)<br>
as the distance from both segments should be equal, closest point<br>
being the lower-right vertex of that LineString.<br>
<br>
But on a 32bit system, and under certain conditions, the second<br>
segment is returned, although the distance from it is the same<br>
up to the 20th significant digits, so there must be a very very<br>
subtle difference in distance calculation based on the<br>
segment-to-point distance function (distance2d_sqr_pt_seg)<br>
<br>
Do you think we should make an effort to avoid divisions<br>
when points have the same Y or X (as in this case) to gain<br>
more numerical stability or should we just accept that<br>
the code gives unstable results there and thus change<br>
the unit test and ensure no promise is given on the matter ?<br>
<br>
BTW, I see there are no unit tests for distance2d_sqr_pt_seg()<br>
function, which was last touched by Raúl in commit<br>
86057e2e46a272838a54eff9e6ebb5e56f33fab7<br>
<br>
--strk;<br>
<br>
Libre GIS consultant/developer<br>
<a href="https://strk.kbt.io/services.html" rel="noreferrer" target="_blank">https://strk.kbt.io/services.html</a><br>
_______________________________________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org" target="_blank">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-devel</a><br>
</blockquote></div>