RFR: 8077587: BigInteger Roots [v19]

Andrew Haley aph at openjdk.org
Mon Apr 21 10:08:08 UTC 2025


On Sun, 20 Apr 2025 16:07:56 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> This PR implements nth root computation for `BigInteger`s using Newton method and optimizes `BigInteger.pow(int)` method.
>> [Here is a proof of convergence of the recurrence used.](https://github.com/user-attachments/files/19785045/nth_root_newton_proof_integers.pdf)
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Code simplification

src/java.base/share/classes/java/math/MutableBigInteger.java line 1924:

> 1922:      * @implNote The implementation is based on the material in Henry S. Warren,
> 1923:      * Jr., <i>Hacker's Delight (2nd ed.)</i> (Addison Wesley, 2013), 279-282.
> 1924:      *

* @implNote The implementation is based on the material in Henry S. Warren,
     * Jr., <i>Hacker's Delight (2nd ed.)</i> (Addison Wesley, 2013), 279-282.
     *

I'm looking at this reference, and I only see integer square root here. But this is n >= 3.

I do see an explanation at [nth root](https://en.wikipedia.org/wiki/Nth_root#Computing_principal_roots)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24690#discussion_r2052217018


More information about the core-libs-dev mailing list