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 some platforms
Date: Sun, 29 Apr 2018 19:21:59 +0000
Message-ID: <E1fCrtX-0004mC-4N@gemulon.postgresql.org> (raw)
Avoid wrong results for power() with NaN input on some platforms.
Per spec, the result of power() should be NaN if either input is NaN.
It appears that on some versions of Windows, the libc function does
return NaN, but it also sets errno = EDOM, confusing our code that
attempts to work around shortcomings of other platforms. Hence, add
guard tests to avoid substituting a wrong result for the right one.
It's been like this for a long time (and the odd behavior only appears
in older MSVC releases, too) so back-patch to all supported branches.
Dang Minh Huong, reviewed by David Rowley
Discussion: https://postgr.es/m/75DB81BEEA95B445AE6D576A0A5C9E936A73E741@BPXM05GP.gisp.nec.co.jp
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/61b200e2f582d0886d9de947e182483339d881fd
Modified Files
--------------
src/backend/utils/adt/float.c | 7 ++---
.../expected/float8-exp-three-digits-win32.out | 30 ++++++++++++++++++++++
src/test/regress/expected/float8-small-is-zero.out | 30 ++++++++++++++++++++++
.../regress/expected/float8-small-is-zero_1.out | 30 ++++++++++++++++++++++
src/test/regress/expected/float8.out | 30 ++++++++++++++++++++++
src/test/regress/sql/float8.sql | 5 ++++
6 files changed, 129 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 some platforms
In-Reply-To: <E1fCrtX-0004mC-4N@gemulon.postgresql.org>
References: <E1fCrtX-0004mC-4N@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