On Wed, 6 May 2026 14:18:56 GMT, Raffaello Giulietti <[email protected]> 
wrote:

>> fabioromano1 has updated the pull request with a new target base due to a 
>> merge or a rebase. The pull request now contains 40 commits:
>> 
>>  - Merge branch 'openjdk:master' into 8366478
>>  - Update since version
>>  - Handle negative degrees differently to simplify and optimize code
>>  - Simplified result's assertions for n < 0
>>  - Some code simplifications
>>  - Added further tests and optimized result assertions
>>  - Correct for loop of precision in two digit tests
>>  - Added one digit tests to cover new paths
>>  - Added tests for exact result cases and handle result assertions for n < 0
>>  - Correct error output message
>>  - ... and 30 more: https://git.openjdk.org/jdk/compare/70f20f9b...2531883c
>
> 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.

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

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

Reply via email to