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

Raffaello Giulietti rgiulietti at openjdk.org
Thu Jul 18 15:54:35 UTC 2024


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

>> I found the way: I can test directly the code through `java.math.Accessor.java`
>
> I think there's a misunderstanding here.
> 
> What I'd like to see is a test that verifies the claim
> 
>         /* For every long value s in [0, 2^32) such that x == s * s,
>          * it is true that s - 1 <= (long) Math.sqrt(x >= 0 ? x : x + 0x1p64) <= s,
> 
> A test similar to my code above should be more than enough.

That test would not exercise any code in `MutableBigInteger` or `BigInteger`. It would just ensure that `MBI.ulongSqrt()` has solid foundations.

Feel free to add the test at your discretion. However, if you decide for it, please make sure that it describes in comments what its purpose really is.

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

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


More information about the core-libs-dev mailing list