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

fabioromano1 duke at openjdk.org
Tue Nov 26 14:54:47 UTC 2024


On Tue, 26 Nov 2024 14:08:23 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Added tests for exact results path
>
> 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...

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

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


More information about the core-libs-dev mailing list