From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
---|---|
To: | Joel Jacobson <joel(at)compiler(dot)org> |
Cc: | Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands. |
Date: | 2024-07-02 11:44:18 |
Message-ID: | CAEZATCW+N9qaE=5_1xcB0isMrirojN=Bd0yY4Pw67iji4swYiQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 2 Jul 2024 at 11:23, Joel Jacobson <joel(at)compiler(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2024-07-02 11:49:30 | Re: plenty code is confused about function level static |
Previous Message | Heikki Linnakangas | 2024-07-02 11:42:50 | Re: Relation bulk write facility |