RFR: 8341402: BigDecimal's square root optimization [v23]

Raffaello Giulietti rgiulietti at openjdk.org
Tue Nov 26 15:04:53 UTC 2024


On Tue, 26 Nov 2024 14:51:44 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> test/jdk/java/math/BigDecimal/SquareRootTests.java line 200:
>> 
>>> 198:             // mc.roundingMode != RoundingMode.UNNECESSARY && mc.precision == 0
>>> 199:             try {
>>> 200:                 result = BigDecimal.TEN.sqrt(arbitrary);
>> 
>> Suggestion:
>> 
>>                 result = input.sqrt(arbitrary);
>
> For the other paths, looking at already existing tests, it seems to me that they should already cover all the possible paths for every `RoundingMode`. There remains only the case when `workingScale` overflows, but I'm not sure if it requires a test, as future implementations could extend the range of the values supported by the algorithm...

OK.
But for the sake of completeness, I would add at least one test case for an overflowing `workingScale`.

Other than that, the PR is then in good shape for approval.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21301#discussion_r1858710734


More information about the core-libs-dev mailing list