RFR: 8077587: BigInteger Roots [v81]

Joe Darcy darcy at openjdk.org
Fri Sep 5 03:45:22 UTC 2025


On Thu, 4 Sep 2025 08:45:33 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> This PR implements nth root computation for BigIntegers using Newton method.
>
> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Small optimization and format comments

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

> 173:         long valBits = Double.doubleToRawLongBits(val);
> 174:         int exponent = (int) ((valBits >> 52) & 0x7ffL) - 1075;
> 175:         long significand = (valBits & ((1L << 52) - 1)) | (1L << 52);

I think that would be better with an explanatory comment -- "OR in implicit bit..." (There are constants for the significand defined in a package-private class in java.lang so no directly usable from here.)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24898#discussion_r2324022628


More information about the core-libs-dev mailing list