RFR: 8341470: BigDecimal.stripTrailingZeros() optimization [v35]

Andrey Turbanov aturbanov at openjdk.org
Fri Oct 11 17:48:15 UTC 2024


On Thu, 10 Oct 2024 20:36:26 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> An optimized algorithm for `BigDecimal.stripTrailingZeros()` that uses repeated squares trick.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refining mathematical definition of remainingZeros

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

> 5329:      */
> 5330:     private static BigDecimal stripZerosToMatchScale(BigInteger intVal, long intCompact, int scale, long preferredScale) {
> 5331:         if(intCompact!=INFLATED) {

Suggestion:

        if (intCompact != INFLATED) {

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1797261119


More information about the core-libs-dev mailing list