On Tue, 29 Apr 2025 15:10:10 GMT, fabioromano1 <d...@openjdk.org> wrote:

>> This PR optimizes `BigInteger.pow(int)` method. The primary enhancement in 
>> `pow()` is not concerned most on execution time, but rather in memory 
>> optimization, because the PR implementation does the "shift of the exponent" 
>> squaring the result rather than the base, so the base is not squared like in 
>> the current implementation, and this permits to save about half of the 
>> memory.
>
> fabioromano1 has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Adjust the type of operand
>  - Use a more loose formula to do range check
>    
>    Use a more loose formula to do range check, in order not to exclude a 
> priori values that may be inside the supported range

A thought for a future PR  - computing long powers could be useful as a public 
method as well.

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

PR Comment: https://git.openjdk.org/jdk/pull/24690#issuecomment-2839942516

Reply via email to