From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid wrong results for power() with NaN input on more platforms
Date: Sun, 29 Apr 2018 22:15:32 +0000
Message-ID: <E1fCubU-0008G7-Ie@gemulon.postgresql.org> (raw)
Avoid wrong results for power() with NaN input on more platforms.
Buildfarm results show that the modern POSIX rule that 1 ^ NaN = 1 is not
honored on *BSD until relatively recently, and really old platforms don't
believe that NaN ^ 0 = 1 either. (This is unsurprising, perhaps, since
SUSv2 doesn't require either behavior.) In hopes of getting to platform
independent behavior, let's deal with all the NaN-input cases explicitly
in dpow().
Note that numeric_power() doesn't know either of these special cases.
But since that behavior is platform-independent, I think it should be
addressed separately, and probably not back-patched.
Discussion: https://postgr.es/m/75DB81BEEA95B445AE6D576A0A5C9E936A73E741@BPXM05GP.gisp.nec.co.jp
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/d6ec3d2375ac3b94d2480c01d7ee7739b236642c
Modified Files
--------------
src/backend/utils/adt/float.c | 24 +++++++++++++++++++---
.../expected/float8-exp-three-digits-win32.out | 6 ++++++
src/test/regress/expected/float8-small-is-zero.out | 6 ++++++
.../regress/expected/float8-small-is-zero_1.out | 6 ++++++
src/test/regress/expected/float8.out | 6 ++++++
src/test/regress/sql/float8.sql | 1 +
6 files changed, 46 insertions(+), 3 deletions(-)
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: Avoid wrong results for power() with NaN input on more platforms
In-Reply-To: <E1fCubU-0008G7-Ie@gemulon.postgresql.org>
References: <E1fCubU-0008G7-Ie@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