Re: Optimizing numeric SUM() aggregate

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Optimizing numeric SUM() aggregate
Дата
Msg-id CAEZATCWgq-BdbjOgvZc-2n4GCv5d6BV0Esxa2H-ew05Vt8QvFg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Optimizing numeric SUM() aggregate  (Andrew Borodin <borodin@octonica.com>)
Список pgsql-hackers
On 27 July 2016 at 10:17, Andrew Borodin <borodin@octonica.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dean Rasheed
Дата:
Сообщение: Re: Optimizing numeric SUM() aggregate
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: handling unconvertible error messages