Need reviewer: JDK 8 CR for Support Integer overflow
Stephen Colebourne
scolebourne at joda.org
Mon Feb 6 22:28:49 UTC 2012
On 6 February 2012 21:15, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>> Separately but related, there are missing methods in BigInteger,
>> longValueExact() and intValueExact()
>
> BigInteger provides a bitLength method than be tested to see if the result
> would overflow. That's a better API than an ArithmeticException and is
> easier for the developer to work with.
As a user, I wouldn't think to use bitLength, and the readability of
the resulting code would be far lower. With BigDecimal, int and long
now having these "exact" methods, not providing the equivalent on
BigInteger should be raising some red flags.
Stephen
More information about the core-libs-dev
mailing list