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

fabioromano1 duke at openjdk.org
Thu Jul 18 14:41:37 UTC 2024


On Thu, 18 Jul 2024 13:39:01 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   More accurate comment
>
> src/java.base/share/classes/java/math/MutableBigInteger.java line 1973:
> 
>> 1971: 
>> 1972:             /* For every long value s in [0, 2^32) such that x == s * s,
>> 1973:              * it is true that s == Math.round(Math.sqrt(x >= 0 ? x : x + 0x1p64)),
> 
> To reinforce this claim, I suggest to add a test for all perfect squares.

I did it, although I'm afraid it takes up too much running time due to the overhead of BigInteger's wrapping...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19710#discussion_r1682972234


More information about the core-libs-dev mailing list