From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Avoid wrong results for power() with NaN input on some platforms |
Date: | 2018-04-29 19:21:59 |
Message-ID: | E1fCrtX-0004mE-4E@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Avoid wrong results for power() with NaN input on some platforms.
Per spec, the result of power() should be NaN if either input is NaN.
It appears that on some versions of Windows, the libc function does
return NaN, but it also sets errno = EDOM, confusing our code that
attempts to work around shortcomings of other platforms. Hence, add
guard tests to avoid substituting a wrong result for the right one.
It's been like this for a long time (and the odd behavior only appears
in older MSVC releases, too) so back-patch to all supported branches.
Dang Minh Huong, reviewed by David Rowley
Discussion: https://postgr.es/m/75DB81BEEA95B445AE6D576A0A5C9E936A73E741@BPXM05GP.gisp.nec.co.jp
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/4d864de486d63b50b1ba74330021504d2c674c23
Modified Files
--------------
src/backend/utils/adt/float.c | 7 ++---
.../expected/float8-exp-three-digits-win32.out | 30 ++++++++++++++++++++++
src/test/regress/expected/float8-small-is-zero.out | 30 ++++++++++++++++++++++
.../regress/expected/float8-small-is-zero_1.out | 30 ++++++++++++++++++++++
src/test/regress/expected/float8.out | 30 ++++++++++++++++++++++
src/test/regress/sql/float8.sql | 5 ++++
6 files changed, 129 insertions(+), 3 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-04-29 19:52:33 | pgsql: Update time zone data files to tzdata release 2018d. |
Previous Message | Tom Lane | 2018-04-29 17:26:35 | pgsql: Cosmetic improvement: use BKI_DEFAULT and BKI_LOOKUP in pg_langu |