<div dir="ltr"><div dir="ltr"><br></div><br>On Mon, Jul 14, 2025 at 10:14 AM fabioromano1 <<a href="mailto:duke@openjdk.org">duke@openjdk.org</a>> wrote:<br>><br>> On Sat, 12 Jul 2025 09:18:27 GMT, fabioromano1 <<a href="mailto:duke@openjdk.org">duke@openjdk.org</a>> wrote:<br>><br>> >> This PR implements nth root computation for BigIntegers using Newton method.<br>> ><br>> > fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:<br>> ><br>> >   Removed useless instruction<br>><br>> The integers are closed under positive powers, and not under positive nthRoots, this is true. However, the problem remains, as if the root degree `n` is negative, then for radicands that are not 1, -1 or 0 we should return 0, and zero raised to a negative exponent is undefined in real numbers, and so the remainder is.<br>><div>Good point. But by that argument nthRoot(int n) should still be well-defined. And the comment for nthRootAndRemainder still looks wrong to me</div><div><br>From the spec, we can take the answer to be "(x.signum() * floor(abs(nthRoot(x, n)))), where nthRoot(x, n) denotes the real nth root of x treated as a real".<div><br></div><div>This means that e.g. the (-3)rd root of 2, is floor(abs(nthRoot(2, -3))),  nthRoot(2, -3) is presumably 1 / nthRoot(2, 3), which is 0.79... So if we take this as the definition, the answer is clearly 0, which is perfectly well-defined.</div></div><div><br></div><div>Again, I'm not arguing for a functional change. I just don't like the spec comments.</div></div>