On Mon, 15 Sep 2025 07:39:00 GMT, fabioromano1 <d...@openjdk.org> wrote:

>> A formula to lower the overestimate for the precision of an exact quotient, 
>> without introducing too expensive operations of division on numerator and 
>> denominator.
>
> fabioromano1 has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Optimization

HI @fabioromano1,
Ah, I haven't worked on that code for exact divide in a while!
For some historical context, the method was added as part of JSR 13, Decimal 
Arithmetic Enhancement, in JDK 5. A fuller derivation of the old bound is 
discussed in:

Fixed, Floating, and Exact Computation with Java's BigDecimalFixed, Floating, 
and Exact Computation with Java's BigDecimal
Dr. Dobb's Journal ยท Jun 1, 2004
https://web.archive.org/web/20210505132021/http://www.drdobbs.com/jvm/fixed-floating-and-exact-computation-wit/184405721

At the time I wrote the code, I looked around at the usual sources, Knuth, etc. 
and asked around for a bound of decimal digits of 1/b if 1/b is representable, 
but didn't find anything.

I see you're still revising the implementation. Once this settles down, a 
review comment from me will be "restore some textual discussion of what the 
algorithm is doing."

For testing, I think it would be good to probe at some values where the old and 
new digit estimation techniques differ.

Also, I think both @rgiulietti and myself look at this PR before it goes back; 
I'll adjust the reviewer count accordingly.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27271#issuecomment-3293076586

Reply via email to