On Wed, 7 May 2025 17:34:27 GMT, fabioromano1 <[email protected]> wrote:
>> Ah right, but you probably want
>> Suggestion:
>>
>> if ((bitLength() - 1L) * exponent > Integer.MAX_VALUE) {
>>
>> I mean `>` rather than `>=`
>
>> Ah right, but you probably want
>
> No, the sufficient condition to get the overflow is `(bitLength() - 1L) *
> exponent + 1L > Integer.MAX_VALUE`, which is equivalent to that one I wrote
> above.
At some point you proposed
(bitLength() - 1L) * exponent >= (long) MAX_MAG_LENGTH << 5
Given the value of `MAX_MAG_LENGTH`, which is 2^26, this is equivalent to
(bitLength() - 1L) * exponent >= 1L << 31
that is, to
(bitLength() - 1L) * exponent > Integer.MAX_VALUE
What am I missing?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24690#discussion_r2078163320