aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/float.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2018-05-02 17:32:40 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2018-05-02 17:32:40 -0400
commitf74d83b3034f830bd68489b4aba99a4dee29c565 (patch)
tree36391b2c01e9fcbf64727f3e3e0bafabf132c796 /src/backend/utils/adt/float.c
parentcec9d03d9165fd62544b63b7f236b9039f1adbe5 (diff)
downloadpostgresql-f74d83b3034f830bd68489b4aba99a4dee29c565.tar.gz
postgresql-f74d83b3034f830bd68489b4aba99a4dee29c565.zip
Revert back-branch changes in power()'s behavior for NaN inputs.
Per discussion, the value of fixing these bugs in the back branches doesn't outweigh the downsides of changing corner-case behavior in a minor release. Hence, revert commits 217d8f3a1 and 4d864de48 in the v10 branch and the corresponding commits in 9.3-9.6. Discussion: https://postgr.es/m/75DB81BEEA95B445AE6D576A0A5C9E936A73E741@BPXM05GP.gisp.nec.co.jp
Diffstat (limited to 'src/backend/utils/adt/float.c')
-rw-r--r--src/backend/utils/adt/float.c21
1 files changed, 1 insertions, 20 deletions
diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c
index 45a62f26161..18b3b949acb 100644
--- a/src/backend/utils/adt/float.c
+++ b/src/backend/utils/adt/float.c
@@ -1462,25 +1462,6 @@ dpow(PG_FUNCTION_ARGS)
float8 result;
/*
- * The POSIX spec says that NaN ^ 0 = 1, and 1 ^ NaN = 1, while all other
- * cases with NaN inputs yield NaN (with no error). Many older platforms
- * get one or more of these cases wrong, so deal with them via explicit
- * logic rather than trusting pow(3).
- */
- if (isnan(arg1))
- {
- if (isnan(arg2) || arg2 != 0.0)
- PG_RETURN_FLOAT8(get_float8_nan());
- PG_RETURN_FLOAT8(1.0);
- }
- if (isnan(arg2))
- {
- if (arg1 != 1.0)
- PG_RETURN_FLOAT8(get_float8_nan());
- PG_RETURN_FLOAT8(1.0);
- }
-
- /*
* The SQL spec requires that we emit a particular SQLSTATE error code for
* certain error conditions. Specifically, we don't return a
* divide-by-zero error code for 0 ^ -1.
@@ -1498,7 +1479,7 @@ dpow(PG_FUNCTION_ARGS)
* pow() sets errno only on some platforms, depending on whether it
* follows _IEEE_, _POSIX_, _XOPEN_, or _SVID_, so we try to avoid using
* errno. However, some platform/CPU combinations return errno == EDOM
- * and result == NaN for negative arg1 and very large arg2 (they must be
+ * and result == Nan for negative arg1 and very large arg2 (they must be
* using something different from our floor() test to decide it's
* invalid). Other platforms (HPPA) return errno == ERANGE and a large
* (HUGE_VAL) but finite result to signal overflow.