RFR: 8341470: BigDecimal.stripTrailingZeros() optimization [v33]
fabioromano1
duke at openjdk.org
Fri Oct 11 18:54:16 UTC 2024
On Fri, 11 Oct 2024 18:41:50 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> 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.
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21323#discussion_r1797319077
More information about the core-libs-dev
mailing list