pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove underflow error in float division with infinite divisor.
Date: Wed, 04 Nov 2020 23:11:25 +0000
Message-ID: <E1kaRw5-0006Ui-Eg@gemulon.postgresql.org> (raw)

Remove underflow error in float division with infinite divisor.

float4_div and float8_div correctly produced zero for zero divided
by infinity, but threw an underflow error for nonzero finite values
divided by infinity.  This seems wrong; at the very least it's
inconsistent with the behavior recently implemented for numeric
infinities.  Remove the error and allow zero to be returned.

This patch also removes a useless isinf() test from the overflow
checks in these functions (non-Inf divided by Inf can't produce Inf).

Extracted from a larger patch; this seems significant outside the
context of geometric operators, so it deserves its own commit.

Kyotaro Horiguchi

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

Branch
------
master

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

Modified Files
--------------
src/include/utils/float.h                             | 8 ++++----
src/test/regress/expected/float4-misrounded-input.out | 6 ++++++
src/test/regress/expected/float4.out                  | 6 ++++++
src/test/regress/expected/float8.out                  | 6 ++++++
src/test/regress/sql/float4.sql                       | 1 +
src/test/regress/sql/float8.sql                       | 1 +
6 files changed, 24 insertions(+), 4 deletions(-)



Message-ID: <E1kaRw5-0006Ui-Eg@gemulon.postgresql.org>
Permalink:  ../E1kaRw5-0006Ui-Eg@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1kaRw5-0006Ui-Eg@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove underflow error in float division with infinite divisor.
  In-Reply-To: <E1kaRw5-0006Ui-Eg@gemulon.postgresql.org>
  References: <E1kaRw5-0006Ui-Eg@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