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

fabioromano1 duke at openjdk.org
Wed Jul 17 14:32:55 UTC 2024


On Wed, 17 Jul 2024 14:17:48 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> @rgiulietti Is it normal that the same code did not find counterexamples until recently, and now it finds them?
>
> I tried on older release, they all agree.

@rgiulietti  This is so strange... anyway, I tried also `long x = n * n`, `long s = (long) Math.ceil(Math.sqrt(x >= 0 ? x : x + 0x1p64))` with the test `s < n`, which I think it's more mathematically natural, and also this never fails for perfect squares.

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

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


More information about the core-libs-dev mailing list