RFR: 8341402: BigDecimal's square root optimization

fabioromano1 duke at openjdk.org
Wed Oct 2 16:45:35 UTC 2024


On Wed, 2 Oct 2024 13:44:42 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:

> Curiously, this one runs in a fraction of a second on the current implementation, but not on the proposed one: `BigDecimal.valueOf(100).sqrt(new MathContext(1_000_000, RoundingMode.HALF_EVEN)).shortValue()`

@rgiulietti  This is because, in the current implementation, the check for even powers of 10 is always done, while in mine is done only if exact result is required.

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

PR Comment: https://git.openjdk.org/jdk/pull/21301#issuecomment-2389131197


More information about the core-libs-dev mailing list