On Wed, 2 Oct 2024 18:16:06 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

>> A possible faster implementation of `stripZerosToMatchScale()` could be 
>> based on dividing by increasing powers of 10 whose exponent doubles at each 
>> step (a kind of repeated squares trick), although the asymptotic running 
>> time would still be exponential.
>
> Without experimenting a bit, it's hard to tell.
> Anyway, I believe the current implementation of `stripZerosToMatchScale()` is 
> O(n^2) rather than exponential, because each single division by 10 is linear.
> 
> But let's focus on `sqrt()` in this PR and leave `stripZerosToMatchScale()` 
> for another time.

@rgiulietti  I tried to implement and test stripping zeros  algorithm with 
repeated squares trick, and on my laptop it takes around two seconds for strip 
one million of zeros. So, I decided to remove the method 
`stripZerosToEvenScale()`, in order to use only the `stripZerosToMatchScale()` 
logic.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21301#discussion_r1785790063

Reply via email to