pgsql: Remove underflow error in float division with infinite divisor.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove underflow error in float division with infinite divisor.
Date: 2020-11-04 23:11:25
Message-ID: E1kaRw5-0006Ui-Eg@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2020-11-05 01:18:08 pgsql: Fix unlinking of SLRU segments.
Previous Message Tom Lane 2020-11-04 21:10:02 pgsql: Declare assorted array functions using anycompatible not anyelem