RFC 6910473: BigInteger negative bit length, value range, and future prospects

Joseph Darcy joe.darcy at oracle.com
Mon Oct 7 22:26:28 UTC 2013


Without comments on the contents of the patch, a change in documented 
behavior would require a ccc request.

Cheers,

-Joe

On 10/3/2013 5:58 PM, Brian Burkhalter wrote:
> I have reviewed this proposed change a couple of times in its current form and it looks good to me.
>
> It would be good to see some comments about the general concept from BigInt cognoscenti, and from (a) Reviewer(s) as concerns the @implNote addition as well as the new ArithmeticExceptions added at several points in the javadoc. With respect to these latter, in the event the patch were to be approved, would a CCC request be in order?
>
> Brian
>
> On Oct 1, 2013, at 7:50 PM, cowwoc wrote:
>
>> Sounds good. Thanks for the clarification.
>>
>> Gili
>>
>> On 01/10/2013 9:25 PM, Dmitry Nadezhin wrote:
>>> I see that I misused the word "to clamp" in this discussion.
>>> I guess that addition with "clumping" means:
>>> return x + y < MIN_VALUE ? MIN_VALUE : x + y > MAX_VALUE ? MAX_VALUE : x +
>>> y;
>>>
>>> The patch actually throws ArithmeticException on overflow:
>>> if (x + y < MIN_VALUE || x + y > MAX_VALUE) throw new ArithmetiException();
>>> else return x + y;
>>>
>>> The word "clamp" appeared in the discussion only.
>>> Comments in the patch don't contain it. They say:
>>>
>>> BigInteger constructors and operations throw {@code
>>> ArithmeticException} whenthe result is out of the supported range.
>>>
>>> On Tue, Oct 1, 2013 at 11:45 PM, cowwoc <cowwoc at bbs.darktech.org> wrote:
>>>
>>>>      I prefer throwing exceptions on unusual conditions (e.g. overflow) and
>>>> letting the user clamp the value if they so wish. Clamping will lead to
>>>> unexpected behavior once values fall outside this range. Yes, it will be
>>>> documented, but I daresay most applications won't ever check for it and
>>>> produce incorrect results as a consequence.
>>>>
>>>> Gili
>>>>
>>>>
>>>> On 01/10/2013 2:19 PM, Dmitry Nadezhin wrote:
>>>>
>>>>> Dear BigInteger experts,
>>>>> Do you have comments to my previous message ?
>>>>> http://mail.openjdk.java.net/**pipermail/core-libs-dev/2013-**
>>>>> September/021264.html<http://mail.openjdk.java.net/pipermail/core-libs-dev/2013-September/021264.html>




More information about the core-libs-dev mailing list