Re: RFR: 8077587: BigInteger Roots [v19]

2025-07-11 Thread Hans Boehm
Apologies if this has been discussed before. The explanation for the exception for negative n ("This would cause the operation to yield a non-integer value.") feels wrong to me. I think the definition of the result as: x.signum() * floor(abs(nthRoot(x, n))) works fine for that case, if nthRoot(x,-

Re: RFR: 8077587: BigInteger Roots [v19]

2025-07-11 Thread fabioromano1
> 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: Optimize the computation of the input's shift Optimize the computation of the input's shift, in order

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-26 Thread Chen Liang
On Thu, 24 Apr 2025 20:18:42 GMT, fabioromano1 wrote: >> @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.o

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-24 Thread fabioromano1
On Thu, 24 Apr 2025 18:17:38 GMT, Raffaello Giulietti wrote: > * Performance enhancements in `pow()`, which is of general interest and does > not require submitting a [CSR](https://wiki.openjdk.org/display/csr/Main). @rgiulietti Yes, but here, the primary enhancement in `pow()` is not concerne

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-24 Thread Raffaello Giulietti
On Mon, 21 Apr 2025 11:47:30 GMT, fabioromano1 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 r

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-21 Thread fabioromano1
On Mon, 21 Apr 2025 10:14:05 GMT, Andrew Haley wrote: > 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

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-21 Thread fabioromano1
On Mon, 21 Apr 2025 10:05:21 GMT, Andrew Haley wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Code simplification > > src/java.base/share/classes/java/math/MutableBigInteger.java line 1924: > >> 1922: * @imp

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-21 Thread Andrew Haley
On Sun, 20 Apr 2025 16:07:56 GMT, fabioromano1 wrote: >> This PR implements nth root computation for `BigInteger`s using Newton >> method and optimizes `BigInteger.pow(int)` method. >> [Here is a proof of convergence of the recurrence >> used.](https://github.com/user-attachments/files/19785045

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-21 Thread Andrew Haley
On Sun, 20 Apr 2025 16:07:56 GMT, fabioromano1 wrote: >> This PR implements nth root computation for `BigInteger`s using Newton >> method and optimizes `BigInteger.pow(int)` method. >> [Here is a proof of convergence of the recurrence >> used.](https://github.com/user-attachments/files/19785045

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-21 Thread Andrew Haley
On Sun, 20 Apr 2025 16:07:56 GMT, fabioromano1 wrote: >> This PR implements nth root computation for `BigInteger`s using Newton >> method and optimizes `BigInteger.pow(int)` method. >> [Here is a proof of convergence of the recurrence >> used.](https://github.com/user-attachments/files/19785045

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-20 Thread Shaojin Wen
On Sun, 20 Apr 2025 16:07:56 GMT, fabioromano1 wrote: >> This PR implements nth root computation for `BigInteger`s using Newton >> method and optimizes `BigInteger.pow(int)` method. >> [Here is a proof of convergence of the recurrence >> used.](https://github.com/user-attachments/files/19785045

Re: RFR: 8077587: BigInteger Roots [v19]

2025-04-20 Thread fabioromano1
> This PR implements nth root computation for `BigInteger`s using Newton method > and optimizes `BigInteger.pow(int)` method. > [Here is a proof of convergence of the recurrence > used.](https://github.com/user-attachments/files/19785045/nth_root_newton_proof_integers.pdf) fabioromano1 has updat