On Sun, 23 Jun 2024 05:57:56 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:

>> src/java.base/share/classes/java/math/MutableBigInteger.java line 293:
>> 
>>> 291:      */
>>> 292:     private int compareShifted(MutableBigInteger b, int ints) {
>>> 293:         this.normalize();
>> 
>> See 
>> [JDK-8334483](http://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8334483)
>
> It is the responsibility of the caller to ensure that the parameters are 
> normalized. Calling normalize isn't free, and it's usually easy to tell when 
> a number needs to be normalized.

@djelinski So, why the documentation does not specify that the method assumes 
the arguments are normalized? And why the method `subtract(MutableBigInteger)` 
does not call `normalize()` on arguments before calling 
`compare(MutableBigInteger)`? Does `subtract` assume implicitly that the 
arguments are normalized?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19710#discussion_r1650022336

Reply via email to