RFR: 8077587: BigInteger Roots [v23]

Raffaello Giulietti rgiulietti at openjdk.org
Mon Jul 14 15:56:53 UTC 2025


On Mon, 14 Jul 2025 15:46:47 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/math/MutableBigInteger.java line 1936:
>> 
>>> 1934:      * where {@code nthRoot(., n)} denotes the mathematical {@code n}th root.
>>> 1935:      * The contents of {@code this} are <em>not</em> changed. The value of {@code this}
>>> 1936:      * is assumed to be non-negative and the root degree {@code n >= 3}.
>> 
>> I don't think `this` can be negative, can it?
>
> @rgiulietti `this` could be negative if it were a `SignedMutableBigInteger`, by the way the same assumption is made in `MBI.sqrtRem()`.

True

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

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


More information about the core-libs-dev mailing list