On Sat, 12 Jul 2025 09:18:27 GMT, fabioromano1 <d...@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:
> 
>   Removed useless instruction

src/java.base/share/classes/java/math/BigInteger.java line 2755:

> 2753:      * is even and this BigInteger is negative, an {@code 
> ArithmeticException} will be
> 2754:      * thrown.
> 2755:      *

I think this specification is a bit confusing.
For example, when x = -10 and n = 2, then y = -3 has the same sign of x and its 
magnitude r = 3 is the largest integer meeting r^n ≤ |x|. However, y is not a 
solution. Sure, there's the note about negative x and even n, but that should 
emerge as a property from the definition, not as an additional condition.

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

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

Reply via email to