On Sat, 26 Apr 2025 19:16:14 GMT, Chen Liang <li...@openjdk.org> wrote:
> It seems your new `unsignedIntPow` already covers `base.mag.length == 1` case > - your `unsignedLongPow` and `unsignedIntPow` are otherwise identical. Can we > just remove this long shortcut and `unsignedLongPow` and use the newly > established `unsignedIntPow`? That can also remove lots of redundant code and > significantly reduce maintenance cost. (Unless BigInteger.multiply(long) is > much cheaper than BigInteger.multiply(BigInteger)) Generally, use privitive integers arithmentic is faster than using BigInteger arithmentic. Anyway, `nthRoot()` depends on `unsignedLongPow()`, so it cannot be avoided without losing performance in nth root computing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24690#discussion_r2061554538