On Wed, 15 Oct 2025 15:56:46 GMT, fabioromano1 <[email protected]> wrote:
>> An implementation of `BigDecimal.nthRoot(int, MathContext)`.
>
> fabioromano1 has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Comment for error analysis
src/java.base/share/classes/java/math/BigDecimal.java line 2160:
> 2158: *
> 2159: * <p>The preferred scale of the returned result is equal to
> 2160: * {@code this.scale()/n}. The value of the returned result is
I think the preferred scale should be ceiling(this.scale() / n).
The IEEE 754 standard has a preferred exponent (negated scale) of
floor(exp(this) / n).
src/java.base/share/classes/java/math/BigDecimal.java line 2181:
> 2179: * @param mc the context to use.
> 2180: * @return the {@code n}<sup>th</sup> root of {@code this}.
> 2181: * @throws ArithmeticException if {@code n == 0 || n ==
> Integer.MIN_VALUE}.
Just out of curiosity, is there a technical reason for the restriction on
MIN_VALUE?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27148#discussion_r2436648335
PR Review Comment: https://git.openjdk.org/jdk/pull/27148#discussion_r2436648498