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

fabioromano1 duke at openjdk.org
Fri Oct 11 19:48:19 UTC 2024


On Fri, 11 Oct 2024 19:38:03 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> This doesn't say much about `maxPowsOf5`, though. You are not using `intVal` but 2^`bitLength` > `intVal` in the computation of `maxPowsOf5`. So maybe the property you are looking for is `maxPowsOf5` - 1 <= log5(intVal) < `maxPowsOf5` || `maxPowsOf5` <= log5(intVal) < `maxPowsOf5` + 1

Actually, it is sufficient that `maxPowsOf5 >= max{integer n : 5^n <= intVal}` to get a correct upper bound, not that are equal. But the closer they are, the better.

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

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


More information about the core-libs-dev mailing list