Re: Optimize numeric multiplication for one and two base-NBASE digit multiplicands.
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Joel Jacobson <joel@compiler.org>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-02T11:44:18Z
Lists: 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
Commits
-
Optimise numeric multiplication for short inputs.
- ca481d3c9ab7 18.0 landed
-
Optimise numeric division for 3 and 4 base-NBASE digit divisors.
- 0aa38db56bf4 16.0 cited
-
Optimise numeric division for one and two base-NBASE digit divisors.
- d1b307eef281 15.0 cited