On Fri, 12 Jul 2024 13:08:37 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

>> fabioromano1 has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Added comment on normalization in MutableBigInteger.sqrtRemZimmermann()
>
> src/java.base/share/classes/java/math/MutableBigInteger.java line 2054:
> 
>> 2052: 
>> 2053:                 rem.add(ONE);
>> 2054:                 rem.subtract(twiceSqrt);
> 
> Shouldn't these be `rem + twiceSqrt - 1`?

No, because `rem` is unsigned, so to perform the correct computation you must 
first add the absolute value of the addends with the same sign, and the 
subtract the absolute value of those with opposite sign.

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

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

Reply via email to