On Mon, 7 Oct 2024 19:35:10 GMT, fabioromano1 <d...@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: > > Use log cache of BigInteger src/java.base/share/classes/java/math/BigDecimal.java line 5268: > 5266: intVal = intVal.shiftRight(powsOf2); // remove powers of 2 > 5267: // maxPowsOf5 == ceil(log5(intVal)) roughly > 5268: long maxPowsOf5 = (long) Math.ceil(intVal.bitLength() * > BigInteger.LOG_TWO / BigInteger.logCache[5]); @rgiulietti Can make sense using `Math.round()` instead of `Math.ceil()` to get better upper bound? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1793425020