On Thu, 25 Sep 2025 12:26:27 GMT, fabioromano1 <d...@openjdk.org> wrote:
>> A formula to lower the overestimate for the precision of an exact quotient, >> without introducing too expensive operations of division on numerator and >> denominator. > > fabioromano1 has updated the pull request incrementally with one additional > commit since the last revision: > > Comments Otherwise looks good. src/java.base/share/classes/java/math/BigDecimal.java line 1807: > 1805: * - if i > j, then a/b = (a/b') ⋅ 5^(i-j) / 10^i. > 1806: */ > 1807: BigInteger den = divisor.unscaledValue(); Maybe "synchronize" the names between the comment and the code. For example, either rename `powsOf2` to `i` or the other way round. Alternatively, provide a "translation table", e.g., `i` <-> `powsOf2`, etc. src/java.base/share/classes/java/math/BigDecimal.java line 1815: > 1813: BigInteger[] qr; > 1814: int i; > 1815: for (i = 0; ; i++) { What about a comment explaining the idea of this and the following fast loops using 5^(2^i) powers to find the correct `powsOf5` (the `j` in the comment)? test/micro/org/openjdk/bench/java/math/BigDecimalDivide.java line 2: > 1: /* > 2: * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. Suggestion: * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. test/micro/org/openjdk/bench/java/math/BigDecimalDivide.java line 153: > 151: } > 152: } > 153: } It would be useful to publish the "before" and "after" results of running these benchmarks. ------------- PR Review: https://git.openjdk.org/jdk/pull/27271#pullrequestreview-3268234720 PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2379473964 PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2379476985 PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2379478040 PR Review Comment: https://git.openjdk.org/jdk/pull/27271#discussion_r2379479325