pgsql: Make numeric power() handle NaNs according to the modern POSIXs - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Make numeric power() handle NaNs according to the modern POSIXs
Date
Msg-id E1fJKYW-0008FL-RB@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: doc: PG 11 release notes adjustments
Next
From: Bruce Momjian
Date:
Subject: pgsql: doc: fix PG 11 attribution