RE: power() function in Windows: "value out of range: underflow"
Huong Dangminh <huo-dangminh@ys.jp.nec.com>
From: Huong Dangminh <huo-dangminh@ys.jp.nec.com>
To: Euler Taveira <euler@timbira.com.br>
Cc: "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>,
"Pg Hackers" <pgsql-hackers@postgresql.org>,
Akio Iwaasa <aki-iwaasa@vt.jp.nec.com>
Date: 2018-04-10T23:46:49Z
Lists: pgsql-bugs, pgsql-hackers
Hi,
Thanks for response
# I will add this thread to current CF soon.
> 2018-04-10 5:30 GMT-03:00 Huong Dangminh <huo-dangminh@ys.jp.nec.com>:
> > There are some cases that power() function does not work correctly
> > with 'NaN' arguments in Windows environment.
> > Something like,
> >
> What is your exact OS version? What is your postgres version? I tested with
> Windows 10 (10.0.16299) x64 and couldn't reproduce the error.
I think it is not depended on OS version but the visual c++ runtime libraries version
(It seem also be included in installers).
My environment:
====================================
- PostgreSQL: 9.6.8
# I am using the EDB PostgreSQL Installer
# It also can reproduce in PostgreSQL 10.3 or 9.5.12
>postgres -V
postgres (PostgreSQL) 9.6.8
>psql -c "select version()"
version
-------------------------------------------------------------
PostgreSQL 9.6.8, compiled by Visual C++ build 1800, 64-bit
(1 row)
>psql -c "select 'NaN'^11"
ERROR: value out of range: underflow
- OS: Microsoft Windows 10 Pro 10.0.14393 build 14393
=============================
> > postgres=# select power('NaN',11);
> > ERROR: value out of range: underflow
> > postgres=# select power('NaN','NaN');
> > ERROR: value out of range: underflow
> > postgres=# select power(11,'NaN');
> > ERROR: value out of range: underflow
> >
> > In Linux environment, instead of ERROR it returns 'NaN'.
> >
> Could you show us a simple test case? Print arguments, result and errno.
It just is my confirmation when debug PostgreSQL in Windows environment.
# I built PostgreSQL with VC++ 2012 in debug mode and confirmed.
I don't know how to print those values.
---
Thanks and best regards,
Dang Minh Huong
NEC Solution Innovators, Ltd.
http://www.nec-solutioninnovators.co.jp/en/
Commits
-
Revert back-branch changes in power()'s behavior for NaN inputs.
- 99095b632094 9.3.23 landed
- f74d83b3034f 10.4 landed
- eab8d6312f15 9.6.9 landed
- 8fbdd63a52df 9.5.13 landed
- 70211459a507 9.4.18 landed
-
Avoid wrong results for power() with NaN input on more platforms.
- d9c7f56da464 9.3.23 landed
- d6ec3d2375ac 9.6.9 landed
- 9e4caa2748f4 9.5.13 landed
- 6bdf1303b34b 11.0 landed
- 59c2df3ae894 9.4.18 landed
- 217d8f3a19ae 10.4 landed
-
Avoid wrong results for power() with NaN input on some platforms.
- 534267e7f3ea 9.3.23 landed
- 48e0f8cbe0d9 9.6.9 landed
- 44ccd11cbbe6 9.4.18 landed
- 3b7fba935ec0 9.5.13 landed
- 61b200e2f582 11.0 landed
- 4d864de486d6 10.4 landed