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.1526421...@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(-)

Reply via email to