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

Raffaello Giulietti rgiulietti at openjdk.org
Thu Nov 28 10:17:39 UTC 2024


On Tue, 26 Nov 2024 17:27:58 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> I don't get your point. Here's an example:
>> 
>> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
>> |  Exception java.lang.ArithmeticException: Overflow
>> |        at BigDecimal.sqrt (BigDecimal.java:2226)
>> |        at (#4:1)
>
>> I don't get your point. Here's an example:
>> 
>> ```
>> BigDecimal.ONE.sqrt(new MathContext(2_000_000_000, RoundingMode.UP))
>> |  Exception java.lang.ArithmeticException: Overflow
>> |        at BigDecimal.sqrt (BigDecimal.java:2226)
>> |        at (#4:1)
>> ```
> 
> Yes, that's correct indeed, I was wrongly assuming that `this.precision() >= minWorkingPrec`.

@fabioromano1 Let's wait for @jddarcy to chime in next week about the issue with the special handling of 10^(2e) powers with huge requested precision.

In the meantime, please replace 2022 with 2024 in the copyright line of the test class (L.2), and add the issue number 8341402 on L.26.

I hope we can integrate before [Rampdown Phase One](https://openjdk.org/projects/jdk/24/).

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

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


More information about the core-libs-dev mailing list