RFR: 8341470: BigDecimal.stripTrailingZeros() optimization [v33]
fabioromano1
duke at openjdk.org
Fri Oct 11 18:58:14 UTC 2024
On Fri, 11 Oct 2024 18:51:21 GMT, fabioromano1 <duke at openjdk.org> wrote:
>> One might prove that this cannot happen for a specific approximation of log5(2), like `LOG_5_OF_2` and for all bit length, but I don't think it is worthwhile to put too much effort on this, given the performance figures.
>
>> If the mathematical value v of the product and its floating-point value fp are separated by an integer i in such a way that fp < i < v, we are in trouble: the ceilings will be different, even if the values are very close to each other.
>
> In that unlikely case, we would have `maxPowsOf5 >= floor(log5(intVal))`, which is still acceptable as an upper bound.
And considering that `Math.round()` rounds to the closest integer, it also should assure `maxPowsOf5 >= floor(log5(intVal))`, giving a better upper bound.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1797322641
More information about the core-libs-dev
mailing list