On Tue, 18 Mar 2025 14:46:01 GMT, fabioromano1 wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> An optimization
>
> This comment is to avoid closing this PR.
> @fabioromano1 Thanks so much for your great work and p
On Fri, 28 Mar 2025 18:24:49 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
On Fri, 28 Mar 2025 18:24:49 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
On Mon, 10 Feb 2025 09:17:51 GMT, Per Minborg wrote:
> This PR seems to be targeting performance, yet no benchmarks are provided
> comparing the current vs. proposed branch with respect to performance. We
> need to understand the upside of the proposed changes.
At my request, reimplementing Bi
On Mon, 10 Feb 2025 09:17:51 GMT, Per Minborg wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> An optimization
>
> This PR seems to be targeting performance, yet no benchmarks are provided
> comparing the current v
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
On Wed, 4 Dec 2024 14:56:02 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Tue, 26 Nov 2024 17:27:58 GMT, fabioromano1 wrote:
>> I don't get your point. Here's an example:
>>
>> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
>> | Exception java.lang.ArithmeticException: Overflow
>> |at BigDecimal.sqrt (BigDecimal.java:2226)
>> |
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Tue, 26 Nov 2024 17:31:38 GMT, Raffaello Giulietti
wrote:
>>> I don't get your point. Here's an example:
>>>
>>> ```
>>> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
>>> | Exception java.lang.ArithmeticException: Overflow
>>> |at BigDecimal.sqrt (BigDecimal.j
On Tue, 26 Nov 2024 17:27:58 GMT, fabioromano1 wrote:
>> I don't get your point. Here's an example:
>>
>> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
>> | Exception java.lang.ArithmeticException: Overflow
>> |at BigDecimal.sqrt (BigDecimal.java:2226)
>> |
On Tue, 26 Nov 2024 17:22:41 GMT, Raffaello Giulietti
wrote:
> I don't get your point. Here's an example:
>
> ```
> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
> | Exception java.lang.ArithmeticException: Overflow
> |at BigDecimal.sqrt (BigDecimal.java:2226)
>
On Tue, 26 Nov 2024 17:13:04 GMT, fabioromano1 wrote:
>>> OK. But for the sake of completeness, I would add at least one test case
>>> for an overflowing `workingScale`.
>>
>> I'm afraid it's not possible to produce such a test case, with the current
>> implementation of `BigInteger`.
>> Indee
On Tue, 26 Nov 2024 17:04:49 GMT, fabioromano1 wrote:
>> OK.
>> But for the sake of completeness, I would add at least one test case for an
>> overflowing `workingScale`.
>>
>> Other than that, the PR is then in good shape for approval.
>
>> OK. But for the sake of completeness, I would add at
On Tue, 26 Nov 2024 15:02:20 GMT, Raffaello Giulietti
wrote:
> OK. But for the sake of completeness, I would add at least one test case for
> an overflowing `workingScale`.
I'm afraid it's not possible to produce such a test case, with the current
implementation of `BigInteger`.
Indeed, `work
On Tue, 26 Nov 2024 14:51:44 GMT, fabioromano1 wrote:
>> test/jdk/java/math/BigDecimal/SquareRootTests.java line 200:
>>
>>> 198: // mc.roundingMode != RoundingMode.UNNECESSARY &&
>>> mc.precision == 0
>>> 199: try {
>>> 200: result = BigDecimal.TEN.sqrt(
On Tue, 26 Nov 2024 14:08:23 GMT, Raffaello Giulietti
wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Added tests for exact results path
>
> test/jdk/java/math/BigDecimal/SquareRootTests.java line 200:
>
>> 198:
On Mon, 25 Nov 2024 19:36:04 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Fri, 22 Nov 2024 14:21:50 GMT, Raffaello Giulietti
wrote:
> Not sure if you are planning to make other code changes before adding the
> tests? From my perspective, the current status of the code looks good.
No, I'm not planning to make other changes, I will add the tests soon.
On Tue, 19 Nov 2024 19:48:25 GMT, Raffaello Giulietti
wrote:
>> Yes, indeed in this case the remainder is always needed, so invoking
>> `workingInt.sqrtAndRemainder()` is faster than checking
>> `!workingInt.equals(sqrt.multiply(sqrt))`, as it avoids the squaring of
>> `sqrt`.
>
> I see.
>
>
On Tue, 19 Nov 2024 09:21:08 GMT, Raffaello Giulietti
wrote:
> While you are at it, it would be useful to add one test for each of the paths
> in the new algorithm (including the exception cases) in the existing
> [SquareRootTests](https://github.com/openjdk/jdk/blob/master/test/jdk/java/math/
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Tue, 19 Nov 2024 18:44:51 GMT, Raffaello Giulietti
wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Correct remainder checking
>
> src/java.base/share/classes/java/math/BigDecimal.java line 2260:
>
>> 2258:
On Tue, 19 Nov 2024 18:43:46 GMT, Raffaello Giulietti
wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Correct remainder checking
>
> src/java.base/share/classes/java/math/BigDecimal.java line 2200:
>
>> 2198:
On Tue, 19 Nov 2024 19:02:09 GMT, fabioromano1 wrote:
>> src/java.base/share/classes/java/math/BigDecimal.java line 2253:
>>
>>> 2251:
>>> 2252: case UP, CEILING -> {
>>> 2253: BigInteger[] sqrtRem =
>>> workingInt.sqrtAndRemainder();
>>
>> Can't th
On Tue, 19 Nov 2024 18:44:27 GMT, Raffaello Giulietti
wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Correct remainder checking
>
> src/java.base/share/classes/java/math/BigDecimal.java line 2253:
>
>> 2251:
>>
On Tue, 19 Nov 2024 14:44:40 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Mon, 18 Nov 2024 14:21:29 GMT, Raffaello Giulietti
wrote:
>> src/java.base/share/classes/java/math/BigDecimal.java line 2248:
>>
>>> 2246: }
>>> 2247: }
>>> 2248: } else { // mc.roundingMode == RoundingMode.UP ||
>>> mc
On Mon, 18 Nov 2024 14:11:43 GMT, Raffaello Giulietti
wrote:
>> fabioromano1 has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Optimize sqrt branch for exact results
>
> src/java.base/share/classes/java/math/BigDecimal.java line 2248:
>
On Fri, 15 Nov 2024 14:21:21 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Fri, 15 Nov 2024 13:22:32 GMT, Raffaello Giulietti
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/BigDecimal.java line 2190:
>
>> 2188:
On Tue, 22 Oct 2024 14:07:30 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
On Mon, 21 Oct 2024 17:01:43 GMT, fabioromano1 wrote:
>>> > Curiously, this one runs in a fraction of a second on the current
>>> > implementation, but not on the proposed one:
>>> > `BigDecimal.valueOf(100).sqrt(new MathContext(1_000_000,
>>> > RoundingMode.HALF_EVEN)).shortValue()`
>>>
>>>
On Wed, 13 Nov 2024 16:07:42 GMT, Raffaello Giulietti
wrote:
>>> Since there's an invocation of `stripTrailingZeros()` anyway, what's the
>>> reason to _not_ "optimize" for other round modes as well, like in the
>>> current implementation?
>>
>> Because it is not necessary to strip zeros when
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Mon, 21 Oct 2024 17:32:33 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an i
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Mon, 21 Oct 2024 16:47:36 GMT, Raffaello Giulietti
wrote:
> Since there's an invocation of `stripTrailingZeros()` anyway, what's the
> reason to _not_ "optimize" for other round modes as well, like in the current
> implementation?
Because it is not necessary to strip zeros when an exact re
On Wed, 2 Oct 2024 16:43:11 GMT, fabioromano1 wrote:
> > Curiously, this one runs in a fraction of a second on the current
> > implementation, but not on the proposed one:
> > `BigDecimal.valueOf(100).sqrt(new MathContext(1_000_000,
> > RoundingMode.HALF_EVEN)).shortValue()`
>
> @rgiulietti T
On Thu, 3 Oct 2024 00:47:23 GMT, Joe Darcy wrote:
> My initial question is what additional regression test cases should be added
> to probe the new code.
@rgiulietti @jddarcy This should be the path tree for the test cases of the
algorithm, whether `signum == 1`:
If `mc.roundingMode == Roundi
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Thu, 3 Oct 2024 12:30:20 GMT, fabioromano1 wrote:
>> I'll open a JBS issue to refer to as soon as you open the new PR.
>>
>> Please keep the first PR comment as short as possible, then add further
>> details in another comment. As only the first comment is auto-copied in
>> every email in t
On Thu, 3 Oct 2024 09:18:56 GMT, Raffaello Giulietti
wrote:
>> @fabioromano1 I agree with starting a new PR for speed up
>> `stripZerosToMatchScale()`.
>
> I'll open a JBS issue to refer to as soon as you open the new PR.
>
> Please keep the first PR comment as short as possible, then add furt
On Thu, 3 Oct 2024 09:10:07 GMT, fabioromano1 wrote:
>> @rgiulietti I tried to implement and test stripping zeros algorithm with
>> repeated squares trick, and on my laptop it takes around two seconds for
>> strip one million of zeros. So, I decided to remove the method
>> `stripZerosToEvenS
On Thu, 3 Oct 2024 07:55:26 GMT, fabioromano1 wrote:
>> Without experimenting a bit, it's hard to tell.
>> Anyway, I believe the current implementation of `stripZerosToMatchScale()`
>> is O(n^2) rather than exponential, because each single division by 10 is
>> linear.
>>
>> But let's focus on
On Thu, 3 Oct 2024 07:55:26 GMT, fabioromano1 wrote:
>> Without experimenting a bit, it's hard to tell.
>> Anyway, I believe the current implementation of `stripZerosToMatchScale()`
>> is O(n^2) rather than exponential, because each single division by 10 is
>> linear.
>>
>> But let's focus on
On Wed, 2 Oct 2024 18:16:06 GMT, Raffaello Giulietti
wrote:
>> A possible faster implementation of `stripZerosToMatchScale()` could be
>> based on dividing by increasing powers of 10 whose exponent doubles at each
>> step (a kind of repeated squares trick), although the asymptotic running
>>
On Thu, 3 Oct 2024 00:05:17 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer using the following relations:
>
> x = y * 10 ^ exp
>
On Wed, 2 Oct 2024 18:16:06 GMT, Raffaello Giulietti
wrote:
> Without experimenting a bit, it's hard to tell. Anyway, I believe the current
> implementation of `stripZerosToMatchScale()` is O(n^2) rather than
> exponential, because each single division by 10 is linear.
>
> But let's focus on
On Wed, 2 Oct 2024 18:06:57 GMT, fabioromano1 wrote:
>> After looking at the code more closely, these are _not_ the reasons for the
>> long running times of my example above.
>> Neither the computation of the large power of 10, nor the multiplication,
>> nor the `BigInteger` square root are slo
On Wed, 2 Oct 2024 17:37:03 GMT, Raffaello Giulietti
wrote:
>> @rgiulietti The only solution I can think of to avoid this is to reimplement
>> Zimmerman's square root algorithm in the class `BigDecimal`, using the radix
>> 10 representation of the number's magnitude.
>
> After looking at the c
On Wed, 2 Oct 2024 16:32:47 GMT, fabioromano1 wrote:
>> src/java.base/share/classes/java/math/BigDecimal.java line 2213:
>>
>>> 2211:
>>> 2212: BigDecimal working = new BigDecimal(this.intVal,
>>> this.intCompact, (int) workingScale, this.precision);
>>> 2213: B
On Wed, 2 Oct 2024 13:44:42 GMT, Raffaello Giulietti
wrote:
> Curiously, this one runs in a fraction of a second on the current
> implementation, but not on the proposed one:
> `BigDecimal.valueOf(100).sqrt(new MathContext(1_000_000,
> RoundingMode.HALF_EVEN)).shortValue()`
@rgiulietti This
On Wed, 2 Oct 2024 16:15:29 GMT, fabioromano1 wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value to an in
On Wed, 2 Oct 2024 10:31:09 GMT, fabioromano1 wrote:
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer
On Wed, 2 Oct 2024 10:31:09 GMT, fabioromano1 wrote:
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer
On Wed, 2 Oct 2024 13:49:29 GMT, Raffaello Giulietti
wrote:
>> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
>> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>>
>> The main steps of the algorithm are as follows:
>> first argument reduce the value
On Wed, 2 Oct 2024 10:31:09 GMT, fabioromano1 wrote:
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer
On Wed, 2 Oct 2024 10:31:09 GMT, fabioromano1 wrote:
> After changing `BigInteger.sqrt()` algorithm, this can be also used to speed
> up `BigDecimal.sqrt()` implementation. Here is how I made it.
>
> The main steps of the algorithm are as follows:
> first argument reduce the value to an integer
After changing `BigInteger.sqrt()` algorithm, this can be also used to speed up
`BigDecimal.sqrt()` implementation. Here is how I made it.
The main steps of the algorithm are as follows:
first argument reduce the value to an integer using the following relations:
x = y * 10 ^ exp
sqrt(x) = sqrt(
90 matches
Mail list logo