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

fabioromano1 duke at openjdk.org
Tue Jul 23 16:05:36 UTC 2024


On Tue, 23 Jul 2024 15:16:27 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> AFAIU, the wrapper performs the normalization, invokes the core algorithm, and does the denormalization just before returning the final result. There's no mention that normalization/denormalization need to be performed at each recursive call. The C code in §5.1 assumes a normalized input and, as far as I can see, does not perform any denormalization.

@rgiulietti  In the C code in §5.1, the length of N is assumed to be `2*n`. The value passed in the recursive invocation is `h = n - l`, with `l = n / 2`. Therefore, if ` n` is odd, then `h == (n / 2) + 1`, so the normalization is implicitly performed in the lines 10-11. I don't know the reason why the unnormalization is not performed, but in theory, according to §3.2, it should be carried out.

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

PR Comment: https://git.openjdk.org/jdk/pull/19710#issuecomment-2245645051


More information about the core-libs-dev mailing list