On Sun, 23 Jun 2024 10:23:15 GMT, Daniel Jeliński <djelin...@openjdk.org> wrote:
>>> Most likely. If you check the code you'll notice that most methods that >>> change the `MutableBigInteger` value (like `subtract`) call `normalize` >>> after performing the operation, so the values should be normalized most of >>> the time. >> >> @djelinski Unfortunately, this is not always true. In fact, without forcing >> normalization before comparing, the program leads to failure in thousands of >> cases, while forcing the normalization resolves all the failures... >> >> So, the question is: since it is not always guaranteed that the arguments >> are normalized, is it responsibility of `subtract` to normalize arguments? > > Which program are you referring to? > > It is the responsibility of the caller of `subtract` to ensure that the > arguments are normalized. This may or may not require calling `normalize`, > depending on whether the argument is normalized or not. @djelinski I'm referring to the tests of square root for BigIntegers. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19710#discussion_r1650040731