RFR 8199258: BigInteger.bitLength() should explicitly specify behavior when the value is zero

Lance Andersen lance.andersen at oracle.com
Wed Mar 7 19:35:45 UTC 2018


looks fine
> On Mar 7, 2018, at 2:21 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
> 
> https://bugs.openjdk.java.net/browse/JDK-8199258
> 
> A diff is included below. If this looks good then a CSR will follow.
> 
> Thanks,
> 
> Brian
> 
> --- a/src/java.base/share/classes/java/math/BigInteger.java
> +++ b/src/java.base/share/classes/java/math/BigInteger.java
> @@ -1,5 +1,5 @@
> /*
> - * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
>  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>  *
>  * This code is free software; you can redistribute it and/or modify it
> @@ -3556,8 +3556,8 @@
>      * Returns the number of bits in the minimal two's-complement
>      * representation of this BigInteger, <em>excluding</em> a sign bit.
>      * For positive BigIntegers, this is equivalent to the number of bits in
> -     * the ordinary binary representation.  (Computes
> -     * {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
> +     * the ordinary binary representation.  For zero this method returns
> +     * {@code 0}.  (Computes {@code (ceil(log2(this < 0 ? -this : this+1)))}.)
>      *
>      * @return number of bits in the minimal two's-complement
>      *         representation of this BigInteger, <em>excluding</em> a sign bit

 <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>





More information about the core-libs-dev mailing list