pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use the built-in float datatypes to implement geometric types
Date: Thu, 16 Aug 2018 17:56:29 +0000
Message-ID: <E1fqMVZ-0003g1-8c@gemulon.postgresql.org> (raw)

Use the built-in float datatypes to implement geometric types

This patch makes the geometric operators and functions use the exported
function of the float4/float8 datatypes.  The main reason of doing so is
to check for underflow and overflow, and to handle NaNs consciously.

The float datatypes consider NaNs values to be equal and greater than
all non-NaN values.  This change considers NaNs equal only for equality
operators.  The placement operators, contains, overlaps, left/right of
etc. continue to return false when NaNs are involved.  We don't need
to worry about them being considered greater than any-NaN because there
aren't any basic comparison operators like less/greater than for the
geometric datatypes.

The changes may be summarised as:

* Check for underflow, overflow and division by zero
* Consider NaN values to be equal
* Return NULL when the distance is NaN for all closest point operators
* Favour not-NaN over NaN where it makes sense

The patch also replaces all occurrences of "double" as "float8".  They
are the same, but were used inconsistently in the same file.

Author: Emre Hasegeli
Reviewed-by: Kyotaro Horiguchi, Tomas Vondra

Discussion: https://www.postgresql.org/message-id/CAE2gYzxF7-5djV6-cEvqQu-fNsnt%3DEqbOURx7ZDg%2BVv6ZMTWbg%40mail...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c4c34008854654279ec30067d72fc5d174d2f42f

Modified Files
--------------
src/backend/access/gist/gistproc.c | 100 ++++----
src/backend/utils/adt/geo_ops.c    | 501 ++++++++++++++++++++-----------------
src/backend/utils/adt/geo_spgist.c |  28 +--
src/include/utils/geo_decls.h      |  19 +-
4 files changed, 343 insertions(+), 305 deletions(-)



Message-ID: <E1fqMVZ-0003g1-8c@gemulon.postgresql.org>
Permalink:  ../E1fqMVZ-0003g1-8c@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fqMVZ-0003g1-8c@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tomas.vondra@postgresql.org
  Subject: Re: pgsql: Use the built-in float datatypes to implement geometric types
  In-Reply-To: <E1fqMVZ-0003g1-8c@gemulon.postgresql.org>
  References: <E1fqMVZ-0003g1-8c@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox