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

fabioromano1 duke at openjdk.org
Tue Nov 19 18:58:02 UTC 2024


On Tue, 19 Nov 2024 18:43:46 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Correct remainder checking
>
> src/java.base/share/classes/java/math/BigDecimal.java line 2200:
> 
>> 2198:                 // Adjust to requested precision and preferred
>> 2199:                 // scale as appropriate.
>> 2200:                 result = result.adjustToPreferredScale(preferredScale, mc.precision);
> 
> Suggestion:
> 
>                 return result.adjustToPreferredScale(preferredScale, mc.precision);
> 
> The redundant `else` below can then be removed, resulting in less "indented" code.
> But the current choice is OK as well if you like it better.

I've made the current choice for consistency with the old implementation, but indeed I think that using `return` is more handy.

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

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


More information about the core-libs-dev mailing list