pgsql: In geo_ops.c, represent infinite slope as Infinity, not DBL_MAX.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: In geo_ops.c, represent infinite slope as Infinity, not DBL_MAX.
Date: 2020-11-21 22:30:53
Message-ID: E1kgbPB-0006UY-NO@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In geo_ops.c, represent infinite slope as Infinity, not DBL_MAX.

Since we're assuming IEEE floats these days, there seems little
reason not to do this. It has the advantage that when the slope is
computed as infinite due to the presence of Inf coordinates, we get
saner behavior than before from line_construct(), and thence also
in some dependent operations such as finding the closest point.

Also fix line_construct() to special-case slope zero. The previous
coding got the right answer in most cases, but it could compute
C as NaN when the point has Inf coordinates.

Discussion: https://postgr.es/m/CAGf+fX70rWFOk5cd00uMfa__0yP+vtQg5ck7c2Onb-Yczp0URA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9fe649ea295f00baf6d0f0c1f9b0cb1298f64fb9

Modified Files
--------------
src/backend/utils/adt/geo_ops.c | 19 ++-
src/test/regress/expected/geometry.out | 254 ++++++++++++++++-----------------
2 files changed, 140 insertions(+), 133 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-11-22 20:48:47 pgsql: Allow a multi-row INSERT to specify DEFAULTs for a generated col
Previous Message Michael Paquier 2020-11-21 10:46:06 pgsql: Remove INSERT privilege check at table creation of CTAS and matv