On Sun, 13 Oct 2024 16:03:09 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

>> @rgiulietti Good, but I would not put the inequality `maxPowsOf5 <= m + 1` 
>> and say that `maxPowsOf5` is never off by more than 1 from the theoretical 
>> `m`, because it is not crucial as `m <= maxPowsOf5`, and because `m` is in 
>> function of `intVal`, while `maxPowsOf5` is in function of `2^b`, so it is 
>> not obvious that there's no power of five `pow` such that `intVal < pow < 
>> 2^b`...
>
> What's really crucial for _correctness_ is to ensure maxPowsOf5 >= k.
> 
> But for performance you also want maxPowsOf5 to be as small as possible. So, 
> the fact that it turns out that maxPowsOf5 <= m + 1 guarantees that 
> maxPowsOf5 is the best value that can be computed very efficiently. It's more 
> a "quality of service" guarantee than anything fundamental.

Perhaps leave m <= maxPowsOf5 <= m + 1 and maxPowsOf5 >= k and drop the note 
"and is never off by more than 1 from the theoretical m"

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

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

Reply via email to