RFR: 8366478: BigDecimal roots [v9]
Joe Darcy
darcy at openjdk.org
Mon Oct 27 05:19:06 UTC 2025
On Fri, 24 Oct 2025 17:03:37 GMT, Raffaello Giulietti <rgiulietti at openjdk.org> wrote:
>> fabioromano1 has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Correct call to rootn() in sqrt()
>
> For n > 0 the spec speaks about 0.5 ulp and 1 ulp, but not about correct rounding, which is slightly more restrictive, as it includes a direction (up, down, to-even, etc.).
> If the implementation already returns the correctly rounded result when n > 0, then the spec could be more precise.
As a general comment, it would be fine (and I would prefer) if numerical code like the n^th root code contained explanations in the sources, even if the explanation was longer than the source. One extreme example of this @rgiulietti and I worked on is for Float16.fma:
https://github.com/openjdk/jdk/blob/e7c7892b9f0fcee37495cce312fdd67dc800f9c9/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java#L1288
I think erring on the side of over-explaining is preferable in terms of aiding future maintenance.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27148#issuecomment-3449558164
More information about the core-libs-dev
mailing list