On Fri, 2 May 2025 16:07:31 GMT, fabioromano1 <d...@openjdk.org> wrote:
>> Raffaello Giulietti has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Clearer and more complete spec of the *pow* methods. > > src/java.base/share/classes/java/lang/Math.java line 3567: > >> 3565: return 1; >> 3566: } >> 3567: if (x == 0 || x == 1) { > > Suggestion: > > if (x == 0 || x == 1 || n == 1) { @fabioromano1 Unless there's evidence that these cases are _very very_ common, there's no point in adding fast paths. See this comment in `unsignedPowExact(long,int)` /* * To keep the code as simple as possible, there are intentionally * no fast paths, except for |x| <= 1. * The reason is that the number of loop iterations below can be kept * very small when |x| > 1, but not necessarily when |x| <= 1. */ ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25003#discussion_r2071857047