On Fri, 11 Jul 2025 12:38:56 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> 
wrote:

> On the other hand, the code contains about 80 lines just to find the initial 
> estimate. To ensure that the code is readable and maintainable, it either 
> needs to be documented better, possibly with math, or simplified so that the 
> correctness becomes obvious even without comments. Performance is not the 
> only dimension we care about in the JDK. Readability and maintainability are 
> even more important in the long term.

At the end of the day, the method used to compute the initial estimate is 
"simply" the generalization of the one used to find the initial estimate of the 
square root, in the previous implementation of `MBI.sqrt()` now replaced by 
Zimmermann's algorithm, so it shouldn't be difficult to document the code, in 
order to prove its correctness.

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

PR Comment: https://git.openjdk.org/jdk/pull/24898#issuecomment-3062325992

Reply via email to