Hi, There are some cases that power() function does not work correctly with 'NaN' arguments in Windows environment. Something like,
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'. The reason here is, When pow() in float.c:dpow() is called with 'NaN' arguments, pow() returns 'NaN' but in Windows environment errno is set to EDOM(invalid floating-point exception). So, PostgreSQL update "result" and cause an ERROR in CHECKFLOATVAL macro. I think it should be return 'NaN' in all of above cases. I have tried to create a patch to fix it. Please confirm the attached file. --- Thanks and best regards, Dang Minh Huong NEC Solution Innovators, Ltd. http://www.nec-solutioninnovators.co.jp/en/
power_NaN.PATCH
Description: power_NaN.PATCH