From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | amborodin(at)acm(dot)org |
Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Optimizing numeric SUM() aggregate |
Date: | 2016-07-27 09:47:16 |
Message-ID: | CAEZATCWgq-BdbjOgvZc-2n4GCv5d6BV0Esxa2H-ew05Vt8QvFg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 27 July 2016 at 10:17, Andrew Borodin <borodin(at)octonica(dot)com> wrote:
>> if (accum->maxdig > (INT_MAX - INT_MAX / NBASE) / (NBASE - 1))
> Woth noting that (INT_MAX - INT_MAX / NBASE) / (NBASE - 1) == INT_MAX
> / NBASE for any NBASE > 1
Interesting. I think it's clearer the way it is in mul_var() though,
because the intention is to avoid letting digits exceed INT_MAX -
INT_MAX/NBASE, so that there is no danger of overflow in the carry
propagation step. The long form makes that clearer (and is just as
efficient, since these expressions will be evaluated by the
preprocessor).
Regards,
Dean
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2016-07-27 11:53:01 | Re: handling unconvertible error messages |
Previous Message | Dean Rasheed | 2016-07-27 09:40:34 | Re: Optimizing numeric SUM() aggregate |