On Wed, 17 Sep 2025 12:21:45 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:
> 
>   Small optimizations

src/java.base/share/classes/java/math/BigDecimal.java line 5161:

> 5159:     private static final double LOG_5_OF_2 = 0.43067655807339306; // 
> double closest to log5(2)
> 5160: 
> 5161:     private static int log5Upper(BigInteger x) {

Add a comment about what this method is supposed to compute.

src/java.base/share/classes/java/math/BigDecimal.java line 5166:

> 5164:         // Since b log5(2) > m, log5(2)+2^(-21) < 1/2
> 5165:         // and (b-1) * LOG_5_OF_2 > [b log5(2) - log5(2)] - 2^(-21),
> 5166:         // then m <= Math.round((b - 1) * LOG_5_OF_2) <= m + 1 follows.

Not sure that the inequalities above also show the `<= m + 1` part

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2375612773
PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2375616450

Reply via email to