RFR: 8334755: Asymptotically faster implementation of square root algorithm [v17]

Joe Darcy darcy at openjdk.org
Thu Jun 27 20:13:28 UTC 2024


On Thu, 27 Jun 2024 20:08:42 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> I have implemented the Zimmermann's square root algorithm, available in works [here](https://inria.hal.science/inria-00072854/en/) and [here](https://www.researchgate.net/publication/220532560_A_proof_of_GMP_square_root).
>> 
>> The algorithm is proved to be asymptotically faster than the Newton's Method, even for small numbers. To get an idea of how much the Newton's Method is slow,  consult my article [here](https://arxiv.org/abs/2406.07751), in which I compare Newton's Method with a version of classical square root algorithm that I implemented. After implementing Zimmermann's algorithm, it turns out that it is faster than my algorithm even for small numbers.
>
> fabioromano1 has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 47 additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into patchSqrt
>  - Added "throw" to throw the ArithmeticException created
>  - Correct BigDecimal.sqrt()
>  - Simplified computing square root of BigDecimal using BigInteger.sqrt()
>  - Removed unnecessary variable
>  - Optimized to compute the remainder only if needed
>  - Optimized multiplication
>  - Code optimization
>  - Merge branch 'openjdk:master' into patchSqrt
>  - Removed useless instruction
>  - ... and 37 more: https://git.openjdk.org/jdk/compare/861563ea...d3ca0d4f

Please separate out any changes to BigDecimal.sqrt to separate follow-up work.

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

PR Comment: https://git.openjdk.org/jdk/pull/19710#issuecomment-2195589860


More information about the core-libs-dev mailing list