Re: [HACKERS] More inaccurate results from numeric pow()

2016-05-05 Thread Dean Rasheed
On 2 May 2016 at 18:38, Tom Lane wrote: > I don't much care for the hardwired magic number here, especially since > exp_var() does not have its limit expressed as "6000" but as > "NUMERIC_MAX_RESULT_SCALE * 3". I think you should rephrase the limit > to use that expression, and also add something

Re: [HACKERS] More inaccurate results from numeric pow()

2016-05-02 Thread Dean Rasheed
On 2 May 2016 at 19:40, Robert Haas wrote: > On Mon, May 2, 2016 at 1:02 PM, Dean Rasheed wrote: >> Doing some more testing of the numeric code patched in [1] I noticed >> another case where the result is inaccurate -- computing 0.12 ^ >> -2345.6 gives a very large number containing 2162 digits,

Re: [HACKERS] More inaccurate results from numeric pow()

2016-05-02 Thread Robert Haas
On Mon, May 2, 2016 at 1:02 PM, Dean Rasheed wrote: > Doing some more testing of the numeric code patched in [1] I noticed > another case where the result is inaccurate -- computing 0.12 ^ > -2345.6 gives a very large number containing 2162 digits, but only the > first 2006 correct, while the last

Re: [HACKERS] More inaccurate results from numeric pow()

2016-05-02 Thread Tom Lane
Dean Rasheed writes: > In fact it's possible to predict exactly how large we need to allow > "val" to become, since the final result is computed using exp_var(), > which accepts inputs up to 6000, so the result weight "val" can be up > to around log10(exp(6000)) ~= 2606 before the final result cau

[HACKERS] More inaccurate results from numeric pow()

2016-05-02 Thread Dean Rasheed
Doing some more testing of the numeric code patched in [1] I noticed another case where the result is inaccurate -- computing 0.12 ^ -2345.6 gives a very large number containing 2162 digits, but only the first 2006 correct, while the last 156 digits are wrong. The reason is this code in power_var(