On Wed, 6 May 2026 14:32:40 GMT, fabioromano1 <[email protected]> wrote:

>> src/java.base/share/classes/java/math/BigDecimal.java line 2259:
>> 
>>> 2257:             }
>>> 2258:             // Test numerical properties at full precision before any 
>>> scale adjustments.
>>> 2259:             assert rootnResultAssertions(result, mc, n);
>> 
>> As you might be aware, `assert` only throws when assertions are enabled on 
>> the command line.
>> 
>> If you want a stronger way to "assert", you should `throw new 
>> AssertionError(...)` in the usual way.
>
> The choice to use `assert` dates back to the first implementation of 
> `BD.sqrt()`. Probably, the author wanted to use the assertion only in the 
> test phase, and not in the user usage.

Likely so, yes.
So let's leave the `assert`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27148#discussion_r3196321390

Reply via email to