Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Дата
Msg-id CAEZATCW+N9qaE=5_1xcB0isMrirojN=Bd0yY4Pw67iji4swYiQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.  ("Joel Jacobson" <joel@compiler.org>)
Ответы Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Список pgsql-hackers
On Tue, 2 Jul 2024 at 11:23, Joel Jacobson <joel@compiler.org> wrote:
>
> Just to be able to verify mul_var() is working as expected when
> rscale is less than the full result, I've added a numeric_mul_patched()
> function that takes a third rscale_adjustment parameter:

Yeah, we could expose such a function, and maybe it would be generally
useful, not just for testing, but that's really a separate proposal.
In general, mul_var() with reduced rscale doesn't guarantee correctly
rounded results though, which might make it less generally acceptable.

For this patch though, the aim is just to ensure the results are the
same as before.

> I've tried to get a different result with and without the fix,
> but I'm failing to hit the bug.
>
> Can you think of an example that should trigger the bug?

9999.0001 * 5000.9999_9999 with rscale = 0 triggers it (returned
50004999 instead of 50005000).

Regards,
Dean



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

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Relation bulk write facility
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: plenty code is confused about function level static