RFR: 8366478: BigDecimal roots

Raffaello Giulietti rgiulietti at openjdk.org
Wed Oct 15 15:20:42 UTC 2025


On Wed, 15 Oct 2025 14:24:51 GMT, fabioromano1 <duke at openjdk.org> wrote:

>> @fabioromano1 In the comments there are claims about the relative errors. Two questions arise:
>> * How were the bounds determined? There seems to be no indication in the comments provided so far.
>> * How much code would be needed to attain correct rounding in all modes?
>
> @rgiulietti 
>> * How much code would be needed to attain correct rounding in all modes?
> 
> The best that can be done is to make the probability of an incorrect rounding as small as desired, but this can be computationally expensive: a probability within $10^{-k}$ means that the integer root must have $k$ more digits, and so the radicand must have $n \cdot k$ more digits.

@fabioromano1 I think it is OK to have more efficient code even if the result is not correctly rounded.
Please add some code comment about your error analysis.

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

PR Comment: https://git.openjdk.org/jdk/pull/27148#issuecomment-3406979761


More information about the core-libs-dev mailing list