On Mon, 21 Oct 2024 17:32:33 GMT, fabioromano1 <d...@openjdk.org> 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 using the following relations:
>> 
>> x = y * 10 ^ exp
>> sqrt(x) = sqrt(y) * 10^(exp / 2) if exp is even
>> sqrt(x) = sqrt(y*10) * 10^((exp-1)/2) is exp is odd
>> 
>> Then use BigInteger.sqrt() on the reduced value to compute the numerical 
>> digits of the desired result.
>> 
>> Finally, scale back to the desired exponent range and perform any adjustment 
>> to get the preferred scale in the representation.
>
> fabioromano1 has updated the pull request incrementally with two additional 
> commits since the last revision:
> 
>  - Removed unused variable
>  - Ensure the result does not exceed the requested precision
>    
>    Ensure the result does not exceed the requested precision to fit the 
> preferred scale

Please make sure that your commits do not break compilation and builds.
[This 
one](https://github.com/openjdk/jdk/pull/21301/commits/82a4357e947817dfdf25274654d14f5cce00c46d)
 does not compile.

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

PR Comment: https://git.openjdk.org/jdk/pull/21301#issuecomment-2427324606

Reply via email to