RFR: 8077587: BigInteger Roots [v52]
fabioromano1
duke at openjdk.org
Mon Jul 28 17:17:00 UTC 2025
On Mon, 28 Jul 2025 17:03:48 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Zimmermann suggestion
>
> src/java.base/share/classes/java/math/MutableBigInteger.java line 1993:
>
>> 1991: * non-significant bits), and the shift is performed in order to lose
>> 1992: * the smallest number of bits in the significand if necessary (minimizing loss of precision).
>> 1993: */
>
> @fabioromano1 I've now spent several hours trying to "reverse engineer" (Java code -> maths) what is going on in the code below that tries to come up with a nice initial estimate of the end result, before starting Newton's loop.
> I'm still not 100% sure I've got everything correctly, and whether each detail is mathematically sound.
> The same will probably happen to other readers and maintainers in the future.
>
> I understand the overall tactic described in the comment above. However, the details of the different (sub)cases deserve (and need) a more detailed documentation to help and guide future enhancements and fixes.
> The best way, of course, is to use maths arguments whenever possible.
@rgiulietti It would be helpful for me to know the points of the code that are still not completly clear, since there are already some comments in the code, so I can know where to add others.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24898#discussion_r2237324405
More information about the core-libs-dev
mailing list