Re: RFR: 8077587: BigInteger Roots [v67]

2025-08-01 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: Code simplification - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v66]

2025-08-01 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: Removed dead code - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: h

Re: RFR: 8077587: BigInteger Roots [v65]

2025-07-31 Thread Raffaello Giulietti
On Thu, 31 Jul 2025 08:40:40 GMT, fabioromano1 wrote: >> This PR implements nth root computation for BigIntegers using Newton method. > > fabioromano1 has updated the pull request with a new target base due to a > merge or a rebase. The pull request now contains 111 commits: > > - Merge branch

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-31 Thread fabioromano1
On Thu, 31 Jul 2025 13:02:06 GMT, Raffaello Giulietti wrote: >> 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

Re: RFR: 8077587: BigInteger Roots [v61]

2025-07-31 Thread Raffaello Giulietti
On Thu, 31 Jul 2025 13:13:39 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 1921: >> >>> 1919: * The contents of {@code this} are not changed. The >>> value of {@code this} >>> 1920: * is assumed to be non-negative and the root degree {@c

Re: RFR: 8077587: BigInteger Roots [v61]

2025-07-31 Thread fabioromano1
On Wed, 30 Jul 2025 10:30:15 GMT, fabioromano1 wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update javadoc > > src/java.base/share/classes/java/math/MutableBigInteger.java line 1921: > >> 1919: * The conte

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-31 Thread Raffaello Giulietti
On Mon, 14 Jul 2025 16:52:31 GMT, fabioromano1 wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Removed useless instruction > > The integers are closed under positive powers, and not under positive > nthRoots, this

Re: RFR: 8077587: BigInteger Roots [v65]

2025-07-31 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 111 commits: - Merge branch 'openjdk:master' into nth-root-branch - Update MutableBigInteger

Re: RFR: 8077587: BigInteger Roots [v64]

2025-07-30 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: Useless instruction - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v63]

2025-07-30 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: Optimization for large degree values - Changes: - all: https://git.openjdk.org/jdk/pull/248

Re: RFR: 8077587: BigInteger Roots [v62]

2025-07-30 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: Optimization for large degree's values - Changes: - all: https://git.openjdk.org/jdk/pull/2

Re: RFR: 8077587: BigInteger Roots [v61]

2025-07-30 Thread fabioromano1
On Wed, 30 Jul 2025 10:02:23 GMT, fabioromano1 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: > > Update javadoc src/java.base/share/class

Re: RFR: 8077587: BigInteger Roots [v61]

2025-07-30 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: Update javadoc - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: http

Re: RFR: 8077587: BigInteger Roots [v60]

2025-07-30 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: Refine comments - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: htt

Re: RFR: 8077587: BigInteger Roots [v59]

2025-07-29 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: Refine the comment - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v58]

2025-07-29 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: Comment - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https://git

Re: RFR: 8077587: BigInteger Roots [v57]

2025-07-29 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: More comments - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https

Re: RFR: 8077587: BigInteger Roots [v56]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 14:38:40 GMT, fabioromano1 wrote: >> Here we have a kind of opposite case: rad can become very imprecise, up to >> losing all bits from x and become 0. >> I think this deserves a quick comment. > >> Here we have a kind of opposite case: rad can become very imprecise, up to >

Re: RFR: 8077587: BigInteger Roots [v56]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 14:36:57 GMT, Raffaello Giulietti wrote: > Here we have a kind of opposite case: rad can become very imprecise, up to > losing all bits from x and become 0. I think this deserves a quick comment. Later there is `rad = Math.nextUp(rad)`, that ensures `rad > 0.0`. --

Re: RFR: 8077587: BigInteger Roots [v56]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 14:19:19 GMT, fabioromano1 wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Comment > > src/java.base/share/classes/java/math/MutableBigInteger.java line 2022: > >> 2020: } else { //

Re: RFR: 8077587: BigInteger Roots [v56]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 14:19:20 GMT, fabioromano1 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: > > Comment src/java.base/share/classes/java

Re: RFR: 8077587: BigInteger Roots [v56]

2025-07-29 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: Comment - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https://git

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 13:55:08 GMT, fabioromano1 wrote: >> Well, that was the easy case! >> (BTW, the condition shExcess != 0 on L.2025 is always true, as shExcess > >> Double.MAX_EXPONENT - Double.PRECISION there.) >> >> There should be similar reasoning for the `else` part on L.2020. >> >> And

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 13:48:47 GMT, Raffaello Giulietti wrote: > starting at L.2034. This is the code that took most of my time. And at what line the obscure parts end? - PR Review Comment: https://git.openjdk.org/jdk/pull/24898#discussion_r2239917951

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 13:26:41 GMT, fabioromano1 wrote: >> My point is that this should be done, not the exact form it takes. Mine or >> yours are both better than nothing. >> >> Another point I wanted to make is that the `if` condition bl - (sh - ex) ≤ >> ME can be replaced with the simpler ex

Re: RFR: 8077587: BigInteger Roots [v55]

2025-07-29 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: Comment abbreviations - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - ne

Re: RFR: 8077587: BigInteger Roots [v54]

2025-07-29 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: More comments - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 13:03:59 GMT, Raffaello Giulietti wrote: >>> To the above, we can also add >>> >>> ``` >>> * >>> * Noting that x ≥ 2^(bl-1) and ex ≥ 0, similarly to the >>> above we further get >>> * x 2^(-sh') ≥ 2^(ex+P-1) ≥ 2^(P-1)

Re: RFR: 8077587: BigInteger Roots [v53]

2025-07-29 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: Further documentation - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - ne

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 13:03:59 GMT, Raffaello Giulietti wrote: > Anyway, I hope I made my point clear: it is better to write proofs rather > than relying on readers to reverse-engineer them from the code. Surely, > there's no need to be pedantic in every single detail. Surely, the problem is to

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 12:25:21 GMT, fabioromano1 wrote: >> @rgiulietti Yes, but why that complication, it is not more natural to prove >> it in the following way? >> >> recalling x < 2^bl: >> x / 2^sh' = x / 2^(sh-ex) ≤ 2^bl / 2^(sh-ex) = 2^(bl - (sh-ex)) ≤ 2^ME < >> Double.MAX_VALUE >> ``` >>

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 12:06:37 GMT, fabioromano1 wrote: >> To the above, we can also add >> >> * >> * Noting that x ≥ 2^(bl-1) and ex ≥ 0, similarly to the >> above we further get >> * x 2^(-sh') ≥ 2^(ex+P-1) ≥ 2^(P-1) >> *

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread fabioromano1
On Tue, 29 Jul 2025 11:14:15 GMT, Raffaello Giulietti wrote: >> The proof might help replacing the `if` condition bl - (sh - ex) ≤ ME with >> ex ≤ ME - P. > > To the above, we can also add > > * > * Noting that x ≥ 2^(bl-1) and ex ≥ 0, similarly to the > abo

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 11:05:43 GMT, Raffaello Giulietti wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 2002: >> >>> 2000: // Try to shift as many bits as possible >>> 2001: // without losing precision in double's representation. >>> 2002:

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Tue, 29 Jul 2025 11:03:24 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Zimmermann suggestion > > src/java.base/share/classes/java/math/MutableBigInteger.java line 2002: > >> 2000:

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-29 Thread Raffaello Giulietti
On Mon, 28 Jul 2025 14:03:16 GMT, fabioromano1 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: > > Zimmermann suggestion src/java.base/shar

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-28 Thread Raffaello Giulietti
On Mon, 28 Jul 2025 17:13:48 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 1993: >> >>> 1991: * non-significant bits), and the shift is performed in >>> order to lose >>> 1992: * the smallest number of bits in the signifi

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-28 Thread fabioromano1
On Mon, 28 Jul 2025 17:03:48 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Zimmermann suggestion > > src/java.base/share/classes/java/math/MutableBigInteger.java line 1993: > >> 1991:

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-28 Thread Raffaello Giulietti
On Mon, 28 Jul 2025 14:03:16 GMT, fabioromano1 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: > > Zimmermann suggestion src/java.base/shar

Re: RFR: 8077587: BigInteger Roots [v52]

2025-07-28 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: Zimmermann suggestion - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - ne

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-28 Thread fabioromano1
On Sun, 27 Jul 2025 08:26:59 GMT, Thomas Zimmermann wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> A zero root's shift can't be excluded > > src/java.base/share/classes/java/math/BigInteger.java line 2773: > >> 2

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-28 Thread fabioromano1
On Sun, 27 Jul 2025 08:26:59 GMT, Thomas Zimmermann wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> A zero root's shift can't be excluded > > src/java.base/share/classes/java/math/BigInteger.java line 2773: > >> 2

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-28 Thread Raffaello Giulietti
On Sun, 27 Jul 2025 08:26:59 GMT, Thomas Zimmermann wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> A zero root's shift can't be excluded > > src/java.base/share/classes/java/math/BigInteger.java line 2773: > >> 2

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-27 Thread Thomas Zimmermann
On Sun, 27 Jul 2025 07:56:59 GMT, fabioromano1 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: > > A zero root's shift can't be excluded sr

Re: RFR: 8077587: BigInteger Roots [v51]

2025-07-27 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: Minor changes - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-27 Thread fabioromano1
On Sun, 27 Jul 2025 07:56:59 GMT, fabioromano1 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: > > A zero root's shift can't be excluded @r

Re: RFR: 8077587: BigInteger Roots [v50]

2025-07-27 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: A zero root's shift can't be excluded - Changes: - all: https://git.openjdk.org/jdk/pull/24

Re: RFR: 8077587: BigInteger Roots [v49]

2025-07-27 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: Minor optimization - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v48]

2025-07-26 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: Code simplification - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v47]

2025-07-26 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: Avoid overflow after first iteration - Changes: - all: https://git.openjdk.org/jdk/pull/248

Re: RFR: 8077587: BigInteger Roots [v46]

2025-07-25 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: Revision changes - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: ht

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread Raffaello Giulietti
On Fri, 25 Jul 2025 15:18:00 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 1934: >> >>> 1932: return new MutableBigInteger[] { this, new >>> MutableBigInteger() }; >>> 1933: >>> 1934: final int bitLength = (int) this.bitLength

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread Raffaello Giulietti
On Fri, 25 Jul 2025 15:26:37 GMT, fabioromano1 wrote: >> Of course. >> To the caller, a `final` parameter does not convey any information, and >> makes the method/constructor header less concise. >> There are thousands of methods in the JDK that do no alter their parameters, >> and yet these ar

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread Raffaello Giulietti
On Fri, 25 Jul 2025 15:36:59 GMT, Raffaello Giulietti wrote: >> Yes, but in this way you see at a glance that the parameter is a constant, >> and you do not have to check all the method's code. > > I guess most developer use a Java IDE for Java development. > My IDE shows variables that are alt

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread fabioromano1
On Fri, 25 Jul 2025 15:24:22 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 1967: >> >>> 1965: sToN1 = BigInteger.unsignedLongPow(sLong, n - 1); >>> 1966: u = ((n - 1) * sLong + Long.divideUnsigned(x, >>> sTo

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread fabioromano1
On Fri, 25 Jul 2025 15:23:32 GMT, Raffaello Giulietti wrote: >> In this case, `final` serves to indicate that the value of `n` is never >> modified by the method. > > Of course. > To the caller, a `final` parameter does not convey any information, and makes > the method/constructor header less

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread fabioromano1
On Fri, 25 Jul 2025 14:57:10 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Round up to do less iterations >> >> With the 1st iteration outside the loop, it is more convenient roundi

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread Raffaello Giulietti
On Fri, 25 Jul 2025 15:14:42 GMT, fabioromano1 wrote: >> src/java.base/share/classes/java/math/MutableBigInteger.java line 1929: >> >>> 1927: * @return the integer {@code n}th root of {@code this} and the >>> remainder >>> 1928: */ >>> 1929: MutableBigInteger[] nthRootRem(final in

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread fabioromano1
On Fri, 25 Jul 2025 14:56:47 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Round up to do less iterations >> >> With the 1st iteration outside the loop, it is more convenient roundi

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-25 Thread fabioromano1
On Fri, 25 Jul 2025 14:56:09 GMT, Raffaello Giulietti wrote: >> fabioromano1 has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Round up to do less iterations >> >> With the 1st iteration outside the loop, it is more convenient roundi

Re: RFR: 8077587: BigInteger Roots [v45]

2025-07-24 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: Round up to do less iterations With the 1st iteration outside the loop, it is more convenient rounding

Re: RFR: 8077587: BigInteger Roots [v44]

2025-07-24 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: Code simplification - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v43]

2025-07-24 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: Update BigIntegerTest.java Adjust pow-nthRoot roundtrip tests to handle negative base with even expone

Re: RFR: 8077587: BigInteger Roots [v42]

2025-07-24 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: Use checkResult() in pow-nthRoot roundtrip tests - Changes: - all: https://git.openjdk.org/

Re: RFR: 8077587: BigInteger Roots [v41]

2025-07-24 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: Added pow() -nthRoot() roundtrip tests - Changes: - all: https://git.openjdk.org/jdk/pull/2

Re: RFR: 8077587: BigInteger Roots [v40]

2025-07-24 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: Ensure an initial overestimate of the root Ensure an initial overestimate of the root by doing 1st ite

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-24 Thread Raffaello Giulietti
On Wed, 23 Jul 2025 23:19:49 GMT, Raffaello Giulietti wrote: >> @rgiulietti >>> The Brent & Zimmermann paper assumes an initial estimate u ≥ ⌊ x 1 / n ⌋ , >>> probably for a (unstated) reason. >> >> The reason is the condition to stop the loop, since it terminates when the >> estimate does no

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-23 Thread Raffaello Giulietti
On Wed, 23 Jul 2025 21:11:16 GMT, fabioromano1 wrote: >> I noticed the usage of exp() and log(), thanks for the change. >> >> My concerns about using transcendental are rooted in [this >> paper](https://members.loria.fr/PZimmermann/papers/accuracy.pdf). >> The Javadoc claims an error of 1 ulp f

Re: RFR: 8077587: BigInteger Roots [v39]

2025-07-23 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 84 commits: - Merge branch 'openjdk:master' into nth-root-branch - Revision changes - More

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-23 Thread fabioromano1
On Wed, 23 Jul 2025 19:49:51 GMT, Raffaello Giulietti wrote: >> @rgiulietti I've changed the formula that computes the initial estimate, now >> it does not use `Math.pow()` anymore, but `Math.exp()` and `Math.log()` >> instead, which are guaranteed to have always an error less than 1 ulp by

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-23 Thread Raffaello Giulietti
On Wed, 23 Jul 2025 17:40:22 GMT, fabioromano1 wrote: >> Can you please provide a succinct "proof" in form of a comment? Needs to be >> convincing, although not necessarily rigorous. > > @rgiulietti I've changed the formula that computes the initial estimate, now > it does not use `Math.pow()`

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-23 Thread fabioromano1
On Wed, 23 Jul 2025 17:05:07 GMT, Raffaello Giulietti wrote: >> @rgiulietti Now that I checked the recurrence better, it seems to me that it >> should give an overestimate if `rLong` is an underestimate, without modify >> it. > > Can you please provide a succinct "proof" in form of a comment?

Re: RFR: 8077587: BigInteger Roots [v38]

2025-07-23 Thread Raffaello Giulietti
On Wed, 23 Jul 2025 16:11:20 GMT, fabioromano1 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: > > More accurate lower bound for doubles val

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-23 Thread Raffaello Giulietti
On Mon, 14 Jul 2025 16:41:15 GMT, fabioromano1 wrote: >> This is my hunch as well. >> So while the use of `nextUp()` and `ceil()` certainly help to achieve an >> overestimate, I'm less sure that this is sufficient when using `pow()`. If >> the latter has some error bigger than a few ulps, then

Re: RFR: 8077587: BigInteger Roots [v38]

2025-07-23 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: More accurate lower bound for doubles values tests - Changes: - all: https://git.openjdk.or

Re: RFR: 8077587: BigInteger Roots [v37]

2025-07-23 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: No need to ceiling the initial estimate if not shifted - Changes: - all: https://git.openjd

Re: RFR: 8077587: BigInteger Roots [v36]

2025-07-23 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: Ensure an initial overestimate of the root Ensure an initial overestimate of the root, using Math.exp(

Re: RFR: 8077587: BigInteger Roots [v35]

2025-07-22 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with two additional commits since the last revision: - Merge branch 'nth-root-branch' of https://github.com/fabioromano1/jdk into nth-root-branch - Refinement

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-22 Thread Raffaello Giulietti
On Tue, 22 Jul 2025 18:38:28 GMT, fabioromano1 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 undefine

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-22 Thread fabioromano1
On Tue, 22 Jul 2025 15:26:25 GMT, Raffaello Giulietti wrote: >> I think this is probably what you are searching for. >> >> If x ≥ 0 there's at most one integer y ≥ 0 meeting y^n ≤ x < (y+1)^n. >> If x < 0 there's at most one integer y ≤ 0 meeting y^n ≥ x > (y-1)^n. >> The method returns y if it

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-22 Thread Raffaello Giulietti
On Wed, 16 Jul 2025 14:40:53 GMT, Raffaello Giulietti wrote: >> I don't know other ways to define it that don't involve the clause `!(x < 0 >> && n % 2 == 0)`. If the first definition is confusing, the only solution I >> see is to remove it, and leave only the formula `(x.signum() * >> floor(

Re: RFR: 8077587: BigInteger Roots [v34]

2025-07-22 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: Added bug id - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https:

Re: RFR: 8077587: BigInteger Roots [v33]

2025-07-22 Thread Mikhail Yankelevich
On Tue, 22 Jul 2025 11:21:46 GMT, fabioromano1 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: > > No need to check for root's shift overflo

Re: RFR: 8077587: BigInteger Roots [v33]

2025-07-22 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: No need to check for root's shift overflow - Changes: - all: https://git.openjdk.org/jdk/pu

Re: RFR: 8077587: BigInteger Roots [v32]

2025-07-22 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: Include one more possible correct bit in initial estimate - Changes: - all: https://git.ope

Re: RFR: 8077587: BigInteger Roots [v31]

2025-07-21 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: Added tests for nth root - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files -

Re: RFR: 8077587: BigInteger Roots [v30]

2025-07-21 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: Revert "Make sure to round up" This reverts commit e305c9f68914553421f2fdd8b4389eaf03946fea.

Re: RFR: 8077587: BigInteger Roots [v29]

2025-07-21 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: Make sure to round up - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - ne

Re: RFR: 8077587: BigInteger Roots [v28]

2025-07-21 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: Discard wrong bits from the initial estimate - Changes: - all: https://git.openjdk.org/jdk/

Re: RFR: 8077587: BigInteger Roots [v27]

2025-07-20 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: Formatting changes - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new:

Re: RFR: 8077587: BigInteger Roots [v26]

2025-07-20 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: Minor change - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https:

Re: RFR: 8077587: BigInteger Roots [v25]

2025-07-20 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: Minor change - Changes: - all: https://git.openjdk.org/jdk/pull/24898/files - new: https:

Re: RFR: 8077587: BigInteger Roots [v24]

2025-07-20 Thread fabioromano1
> This PR implements nth root computation for BigIntegers using Newton method. fabioromano1 has updated the pull request incrementally with two additional commits since the last revision: - Removed trailingwhitespace - Revision changes Revision changes, with explanation comment for init

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-16 Thread Raffaello Giulietti
On Wed, 16 Jul 2025 10:32:41 GMT, fabioromano1 wrote: >> 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 specifi

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-16 Thread fabioromano1
On Wed, 16 Jul 2025 10:01:00 GMT, Raffaello Giulietti wrote: >> 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:

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-16 Thread Raffaello Giulietti
On Sat, 12 Jul 2025 09:18:27 GMT, fabioromano1 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.bas

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-14 Thread Hans Boehm
On Mon, Jul 14, 2025 at 10:14 AM fabioromano1 wrote: > > On Sat, 12 Jul 2025 09:18:27 GMT, fabioromano1 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 l

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-14 Thread fabioromano1
On Mon, 14 Jul 2025 15:43:58 GMT, Raffaello Giulietti wrote: >> @rgiulietti The convergence of the recurrence is guaranteed if the initial >> estimate is larger than or equal to the exact value, AFAIK no guarantee is >> given when the estimate is smaller than the exact value. > > This is my hu

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-14 Thread fabioromano1
On Sat, 12 Jul 2025 09:18:27 GMT, fabioromano1 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 The integers

Re: RFR: 8077587: BigInteger Roots [v23]

2025-07-14 Thread fabioromano1
On Mon, 14 Jul 2025 15:52:19 GMT, fabioromano1 wrote: > This is my hunch as well. So while the use of `nextUp()` and `ceil()` > certainly help to achieve an overestimate, I'm less sure that this is > sufficient when using `pow()`. If the latter has some error bigger than a few > ulps, then we

  1   2   >