RFR: 8077587: BigInteger Roots [v19]
Raffaello Giulietti
rgiulietti at openjdk.org
Thu Apr 24 18:27:43 UTC 2025
On Mon, 21 Apr 2025 11:47:30 GMT, fabioromano1 <duke at openjdk.org> wrote:
>>> [Here is a proof of convergence of the recurrence used.](https://github.com/user-attachments/files/19785045/nth_root_newton_proof_integers.pdf)
>>
>> That's very nice. It would be even nicer if this was a permalink into the JDK repo, and a reference in the source code.
>
>> That's very nice. It would be even nicer if this was a permalink into the JDK repo, and a reference in the source code.
>
> @theRealAph Ok. It would be useful to have a link to an explanation on how this can be done, if there is one. Thanks.
@fabioromano1 I just had a cursory glance at this PR.
AFAIU, there are two main contributions here:
- Performance enhancements in `pow()`, which is of general interest and does not require submitting a [CSR](https://wiki.openjdk.org/display/csr/Main).
- Introduction of a new public API point for the _n_-th root, which would require a CSR.
It's important to understand that if we add public API points, there must be some evidence and consensus about their general usefulness and demand for them. Every addition is a commitment for this community in terms of code maintenance, reviews, testing, documentation, so they should be evaluated with this perspective in mind.
In this case, I feel that the proposed _n_-th root might not be among the top priority API points to add to `BigInteger`. Perhaps the overall plan is to use this method to implement a _n_-th root in `BigDecimal` in some followup PR, but this is not stated here.
Anyway, a [preliminary discussion](https://openjdk.org/guide/#socialize-your-change) about the proposal should take place on the mailing list, _before_ submitting the PR and invest too much work on the code.
To make progress here, I suggest to split this PR in two, if technically possible:
- One for the enhancements in `pow`, with JMH results before/after.
- Another PR for the proposed _n_-th root.
Thanks
-------------
PR Comment: https://git.openjdk.org/jdk/pull/24690#issuecomment-2828501417
More information about the core-libs-dev
mailing list