Re: power() function in Windows: "value out of range: underflow"

2018-05-02 Thread Tom Lane
"David G. Johnston" writes: > On Tue, May 1, 2018 at 12:08 PM, Robert Haas wrote: >> That's probably true, but making dev, test, and production boxes >> similar is generally good practice and users can do as much or as >> little of it as they

Re: power() function in Windows: "value out of range: underflow"

2018-05-01 Thread David G. Johnston
On Tue, May 1, 2018 at 12:08 PM, Robert Haas wrote: > > > But I don't think > > we should discount the existence of the former category. Deploying > > to production on an older release of $system than you develop on > > is hardly an unusual scenario. > > That's probably

Re: power() function in Windows: "value out of range: underflow"

2018-05-01 Thread Robert Haas
On Tue, May 1, 2018 at 1:49 PM, Tom Lane wrote: > The point here, I think, is that you get behavior X on approximately 100% > of modern platforms, but (without this patch) behavior Y on some number of > older platforms. People who have tested their app on a modern platform >

Re: power() function in Windows: "value out of range: underflow"

2018-05-01 Thread Tom Lane
Robert Haas writes: > On Sun, Apr 29, 2018 at 7:24 PM, David Rowley > wrote: >> I think we should back patch and try to be consistent about the >> power(float8 1.0, 'NaN') and power('NaN', float8 0.0) cases. The >> archives don't show any

Re: power() function in Windows: "value out of range: underflow"

2018-05-01 Thread Robert Haas
On Sun, Apr 29, 2018 at 7:24 PM, David Rowley wrote: > I think we should back patch and try to be consistent about the > power(float8 1.0, 'NaN') and power('NaN', float8 0.0) cases. The > archives don't show any complaints about power() with NaN until this > one, so

RE: power() function in Windows: "value out of range: underflow"

2018-04-30 Thread Huong Dangminh
> From: Tom Lane [mailto:t...@sss.pgh.pa.us] > > I updated the patch as David Rowley mentioned. > > Pushed. I'd mainly note that you need to update all the variant float8 > expected-files, not just the primary one. (Sometimes this requires a bit Thank you. I will be careful next time. > of

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread David Rowley
On 30 April 2018 at 10:22, Tom Lane wrote: > David Rowley writes: >> Wouldn't this machine have returned 1 before this patch though? > > No, don't think so, because it doesn't set EDOM for the case. > > Basically what we're doing here is making

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread Tom Lane
David Rowley writes: > Wouldn't this machine have returned 1 before this patch though? No, don't think so, because it doesn't set EDOM for the case. Basically what we're doing here is making sure that we get results conforming to current POSIX even on machines that

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread David Rowley
On 30 April 2018 at 09:19, Tom Lane wrote: > http://netbsd.gw.com/cgi-bin/man-cgi?pow+3+NetBSD-5.2.3 > > which goes to great lengths to justify NaN^0 = 1 while saying nothing > to suggest that 1^NaN might not yield NaN. > > I'm not sure if we should add more special-case code

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread Tom Lane
David Rowley writes: > I wonder if it's better just to hard code these two cases before even > calling the pow() function. Yeah, see my followup --- I also found out that SUSv2 (POSIX 1997) doesn't require either of these special cases, which helps explain why the

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread David Rowley
On 30 April 2018 at 07:24, Tom Lane wrote: > Pushed. I'd mainly note that you need to update all the variant float8 > expected-files, not just the primary one. (Sometimes this requires a > bit of guesswork, but here we're expecting all platforms to produce > the same result.

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread Tom Lane
David Rowley writes: > You patch fixes the problem for me, and importantly the two following > cases still work: > postgres=# select power(1,'NaN'); > power > --- > 1 > (1 row) > postgres=# select power('NaN', 0); > power > --- > 1 > (1 row) >

Re: power() function in Windows: "value out of range: underflow"

2018-04-29 Thread Tom Lane
Huong Dangminh writes: >> 2018-04-11 0:13 GMT-03:00 David Rowley : >>> I can recreate this when building with MSVC 2012. I confirm that I see >>> the same as you. Microsoft are setting errno to EDOM in the above 3 >>> cases, where in Linux

RE: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread Huong Dangminh
> > I updated the patch as David Rowley mentioned. > > Looks fine to me. Please add to the next commitfest. Thanks. Added. > -- > David Rowley http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > --- Thanks and best regards, Dang Minh

Re: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread David Rowley
On 11 April 2018 at 16:42, Huong Dangminh wrote: > I updated the patch as David Rowley mentioned. Looks fine to me. Please add to the next commitfest. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training &

RE: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread Huong Dangminh
Thanks for confirming. > 2018-04-11 0:13 GMT-03:00 David Rowley : > > I can recreate this when building with MSVC 2012. I confirm that I see > > the same as you. Microsoft are setting errno to EDOM in the above 3 > > cases, where in Linux the result is still NaN,

Re: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread Euler Taveira
2018-04-11 0:13 GMT-03:00 David Rowley : > I can recreate this when building with MSVC 2012. I confirm that I see > the same as you. Microsoft are setting errno to EDOM in the above 3 > cases, where in Linux the result is still NaN, just the errno is not > set. >

Re: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread David Rowley
On 10 April 2018 at 20:30, Huong Dangminh wrote: > 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

RE: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread Huong Dangminh
Hi, Thanks for response # I will add this thread to current CF soon. > 2018-04-10 5:30 GMT-03:00 Huong Dangminh : > > There are some cases that power() function does not work correctly > > with 'NaN' arguments in Windows environment. > > Something like, > > > What is

Re: power() function in Windows: "value out of range: underflow"

2018-04-10 Thread Euler Taveira
2018-04-10 5:30 GMT-03:00 Huong Dangminh : > 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