RFR: 8334755: Asymptotically faster implementation of square root algorithm [v42]
fabioromano1
duke at openjdk.org
Sat Jul 27 12:20:37 UTC 2024
On Sat, 27 Jul 2024 11:47:23 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 condition for MBI.safeRightShift()
>
> test/micro/org/openjdk/bench/java/math/BigIntegerSquareRoot.java line 74:
>
>> 72:
>> 73: for (int i = 0; i < TESTSIZE; i++) {
>> 74: int value = Math.abs(r.nextInt());
>
> There's a risk of an overflow here if the random `int` is `MIN_VALUE`, which would throw an exception later.
The benchmark `BigIntegers.java`, on which I based this, has the same problem.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19710#discussion_r1693949478
More information about the core-libs-dev
mailing list