]> granicus.if.org Git - postgresql/commit
Avoid wrong results for power() with NaN input on more platforms.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 29 Apr 2018 22:15:16 +0000 (18:15 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 29 Apr 2018 22:15:16 +0000 (18:15 -0400)
commitd6ec3d2375ac3b94d2480c01d7ee7739b236642c
treeb3885cbbdac10fe89bf34272dc1d03cfd9557518
parent2acbeea48c38b1574b5f59f4e2e05fbad2e45ec5
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
src/backend/utils/adt/float.c
src/test/regress/expected/float8-exp-three-digits-win32.out
src/test/regress/expected/float8-small-is-zero.out
src/test/regress/expected/float8-small-is-zero_1.out
src/test/regress/expected/float8.out
src/test/regress/sql/float8.sql