pgsql: Make numeric power() handle NaNs according to the modern POSIX s

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make numeric power() handle NaNs according to the modern POSIX s
Date: 2018-05-17 15:11:00
Message-ID: E1fJKYW-0008FL-RB@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make numeric power() handle NaNs according to the modern POSIX spec.

In commit 6bdf1303b, we ensured that power()/^ for float8 would honor
the NaN behaviors specified by POSIX standards released in this century,
ie NaN ^ 0 = 1 and 1 ^ NaN = 1. However, numeric_power() was not
touched and continued to follow the once-common behavior that every
case involving NaN input produces NaN. For consistency, let's switch
the numeric behavior to the modern spec in the same release that ensures
that behavior for float8.

(Note that while 6bdf1303b was initially back-patched, we later undid
that, concluding that any behavioral change should appear only in v11.)

Discussion: https://postgr.es/m/10898.1526421338@sss.pgh.pa.us

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/numeric.c | 21 +++++++++++++++++++--
src/test/regress/expected/numeric.out | 31 +++++++++++++++++++++++++++++++
src/test/regress/sql/numeric.sql | 7 +++++++
3 files changed, 57 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2018-05-17 18:23:32 pgsql: doc: fix PG 11 attribution
Previous Message Bruce Momjian 2018-05-17 00:36:32 pgsql: doc: PG 11 release notes adjustments