RFR: 8077587: BigInteger Roots [v23]

fabioromano1 duke at openjdk.org
Mon Jul 14 15:49:42 UTC 2025


On Mon, 14 Jul 2025 14:32:45 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Removed useless instruction
>
> 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 assuption is made in `MBI.sqrtRem()`.

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

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


More information about the core-libs-dev mailing list