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

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: Re: power() function in Windows: "value out of range: underflow"
Date: 2018-04-29 22:10:34
Message-ID: CAKJS1f_tQSBf8yrn=Z9w4rTfuxLzpt0xUEJiojZEs_gTehmmug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 30 April 2018 at 09:19, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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 for that, or just
> remove that test case again. Historically we've not really felt that it
> was our job to mask oddities of the platform's math library, so the fact
> that power() is worrying about this seems like unjustified scope creep.
> On the other hand, we do have a bunch of special cases there already,
> so refusing to handle older BSD would be a tad inconsistent.

(Sorry missed your reply before I sent my last one)

Wouldn't this machine have returned 1 before this patch though? Surely
changing this behaviour this plaetform in favour of fixing on another
is worse than doing nothing. If that's the case, I think the only
option is to add a special case or revert this and document that the
behaviour may vary depending on the platform's implementation of
pow(). I think the special case is worth it, since there's already
some for the error cases.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2018-04-29 22:22:42 Re: power() function in Windows: "value out of range: underflow"
Previous Message Tom Lane 2018-04-29 22:10:17 Re: power() function in Windows: "value out of range: underflow"

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-04-29 22:22:42 Re: power() function in Windows: "value out of range: underflow"
Previous Message Tom Lane 2018-04-29 22:10:17 Re: power() function in Windows: "value out of range: underflow"