On Tue, 22 Jul 2025 18:38:28 GMT, fabioromano1 <d...@openjdk.org> wrote:

> The cases in which the method throws correspond to the cases in which the 
> integer root is not defined.

Yes, that's why it should be part of the definition: like in "the largest 
integer ..., if it exists; otherwise the result is undefined, and the method 
throws".

Specified this way, one `@throws` clause for undefined r would be sufficient. 
The implementation can still generate different messages, but this is not part 
of the spec.

> For the specification, the equivalence of the definition with the formula ... 
> makes sense only when the definition itself makes sense, i.e. only when the 
> method does not throw.

IMO, this could be expressed more clearly as "when r is defined, it is equal to 
..." or something similar.

(As an aside, if R is taken as a subfield of C, the principal value of the nth 
root needs not be real, even in the case of odd n > 0. That's why I asked about 
the meaning of nth root here. And even "principal value" doesn't have a 
universally accepted definition, as it depends on the choice of the range for 
the "principal" phase angle of a complex number.)

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

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

Reply via email to