RFR: 8367603: Optimize exact division in BigDecimal [v14]

fabioromano1 duke at openjdk.org
Wed Sep 24 17:34:32 UTC 2025


On Wed, 24 Sep 2025 12:26:32 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> 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 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

@rgiulietti Remember that `m <= Math.round(b * LOG_5_OF_2) <= m + 1` is already implied by the inequalities, as shown at L. 5148 of the current version.

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

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


More information about the core-libs-dev mailing list